Thread overview
Can't chain reduce(seed, range)
Aug 31, 2015
Yuxuan Shui
Aug 31, 2015
Jonathan M Davis
Aug 31, 2015
rsw0x
August 31, 2015
Why is reduce defined as 'auto reduce(S, R)(S seed, R r)', instead of reduce(R r, S seed)? I can't chain it.

Maybe provide both?
August 31, 2015
On Monday, August 31, 2015 01:31:58 Yuxuan Shui via Digitalmars-d-learn wrote:
> Why is reduce defined as 'auto reduce(S, R)(S seed, R r)',
> instead of reduce(R r, S seed)? I can't chain it.
>
> Maybe provide both?

The reasons why the seed is first are historical. It predates UFCS being added to the language, so there was no reason to put the range first when when it was added to Phobos. I believe that there have been attempts to fix it, but AFAIK, they ran into too many problems to be able to do it without breaking existing code.

- Jonathan M Davis

August 31, 2015
On Monday, 31 August 2015 at 01:32:01 UTC, Yuxuan Shui wrote:
> Why is reduce defined as 'auto reduce(S, R)(S seed, R r)', instead of reduce(R r, S seed)? I can't chain it.
>
> Maybe provide both?

You might be interested in this PR
https://github.com/D-Programming-Language/phobos/pull/1955

It's a bit old, left a ping to see what's up.