[Issue 10670] std.algorithm.reduce: no-seed initialization wrong design

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 22 04:55:08 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10670


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #4 from bearophile_hugs at eml.cc 2013-07-22 04:55:04 PDT ---
(In reply to comment #2)

> In the case of floats, well... I'd argue that using the seedless variety of
> reduce on a float range is already a bug,

I don't think it's a bug, this is Python:

>>> a = [2.0, 3.0, 4.0]
>>> reduce(lambda x, y: x * y, a)
24.0

I have a ton of D code that relies on such behavour of D reduce.

I suggest to just swap the seed and sequence arguments of reduce, to support
UFCS chains, and leave the rest of reduce as it is.

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


More information about the Digitalmars-d-bugs mailing list