[Issue 8755] Change the order of reduce arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 21 03:46:18 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=8755



--- Comment #18 from bearophile_hugs at eml.cc 2014-03-21 03:46:15 PDT ---
(In reply to comment #17)

> it would be possible to make `Tuple` and
> `args...` co-exist as input argument style. EG:
> 
> r = a.fold!("a + b", "a + b * b")(0.0, 0.0); //OK!
> r = a.fold!("a + b", "a + b * b")(tuple(0.0, 0.0)); //OK! too!
> 
> The second one is more verbose, but I see its justified if your seed is already
> in the form of a tuple.

What I don't like is to give only 1 single scalar argument if you have N
functions and then implicitly multiply the single seed N times. Similar
implicit behaviours look handy, but they make the code less clear, and later
usually they find some way to bite your rump.

On the other hand I think that it's uncommon to give more than one function to
reduce/fold. So this whole sub-feature is could even be chopped away,
simplifying fold.

How many real usages of multi-function reduce to you have in Phobos?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list