|
 |
On Tue, 23 Sep 2008 00:20:42 +0200, Darren New <dne### [at] san rr com> wrote:
> Welll..... There's still a bunch of syntax. Template instantiation, <<
> and >> for I/O, etc. I mean, compare Haskell add-up-a-list-of-numbers
> to C++'s. Something like
> fold (+) my_list
> to something like
> for (j = std::list.begin(); j != std::list.end(); j = j.next())
> i += j.value;
> or some such. :-)
'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 );
--
FE
Post a reply to this message
|
 |