digitalmars.D.bugs - [Issue 11128] New: std.algorithm.reduce one-argument version cannot always be chained using UFCS
- d-bugmail puremagic.com (29/29) Sep 26 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11128
- d-bugmail puremagic.com (14/14) Sep 27 2013 http://d.puremagic.com/issues/show_bug.cgi?id=11128
http://d.puremagic.com/issues/show_bug.cgi?id=11128 Summary: std.algorithm.reduce one-argument version cannot always be chained using UFCS Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: daniel350 bigpond.com Example: arr1.reduce!((s, x) => s + (x / 3)); Because the natural seed value is arr1.front, depending on the type, this will return an incorrect result, so you therefore need to provide a seed, using the one-argument version of std.algorithm.reduce, this cannot be done. You are therefore forced to use the standard syntax: reduce!((s, x) => s + (x / 3))(0, arr1); Or: 0.reduce!((s, x) => s + (x / 3))(arr1); This seems counter-intuitive, compared to: arr1.reduce!((s, x) => s + (x / 3))(0); This change wouldn't play pretty. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 26 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11128 Peter Alexander <peter.alexander.au gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |peter.alexander.au gmail.co | |m Resolution| |DUPLICATE 14:43:37 PDT --- Yep, it's irritating, and a known issue. Closing as dupe. *** This issue has been marked as a duplicate of issue 8755 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 27 2013