What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from 2012-10-04 09:39:15 PDT ---
(In reply to comment #0)

> auto fold(range, seed) {}


> Giving it a default of "a + b" would also improve its use as summing is
> probably the most common use case.

This is not a good idea. Invisible defaults are magic, and magic is bad.

It's better to introduce an optimized sum() function, as in Haskell:

Prelude> sum [1,2,3]

And Python:

>>> sum([1,2,3])

A sum() function needs to work with fixed sized arrays too (like reduce/fold),
and it needs a specialization for short fixed-sized arrays, so this code:

int[4] a;
auto b = sum(a);

gets compiled about as:

int[4] a;
auto b = a[0] + a[1] + a[2] + a[3];

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to