foldLeft implementation of the forward algorithm...not sure I like it