gonum/floats — pull request #25 by Jragonmiris (2014-11-05 08:37:01+00:00)
Title: Add a few higher order functions

The primary purpose of this was FoldRight and FoldLeft. If desired, I can make them closer to CumProd and CumSum by storing the current cumulative value at each step (though personally I don't like that for fold).

I also added a Filter, which is similar to Find, except it just filters the list for you instead of just returning indices. This is slightly redundant, but then, Count is redundant if you do `len(Find(dst, f, s, -1))` as well.

Finally, I added ApplyTo since it was a bit odd we didn't have a way to map functions and place the result in a **different** slice.

I can remove anything we decide we don't want.

All functions have tests (except Filter because it's a simple passthrough to FilterTo), as well as examples. (One of the filter ones is pretty cool actually -- it filters the slice so that the new slice is a strictly increasing subsequence).