Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> 'fold' (should probably be 'foldl1') is just a library function, not a
> language primitive. The corresponding C++ library function is
> 'std::accumulate'.
> std::accumulate( my_list.begin(), my_list.end(), 0 );
Which got me thinking: Does foldl1 in haskell work for data containers
other than lists? What if you want to apply it to only a sub-range inside
the data container rather than to the entire container? (Can you do it
without copying the sub-range to a separate container?)
--
- Warp
Post a reply to this message
|