Summary: Change the order of reduce arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2012-10-04 09:03:45 PDT ---
Reduce cannot have a seed applied elegantly when used with UFCS due to the
argument order being range, seed. A newly named version with the argument order
reversed would allow the use of the full range of reduce's capabilities with
UFCS arguments.


auto fold(range, seed) {}

to allow:

[1,2,3,4,5].fold!((a, b) => a + b * b)(0).writeln;

With the possibility of a longer chain in place of the array argument, a normal
use with UFCS. At present only a few uses such as sum, max and min are usable
with the unseeded form, limiting the usefulness of reduce.

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

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

Reply via email to