digitalmars.D.bugs - [Issue 12562] New: std.algorithm.mul
- d-bugmail puremagic.com (24/24) Apr 11 2014 https://issues.dlang.org/show_bug.cgi?id=12562
https://issues.dlang.org/show_bug.cgi?id=12562 Issue ID: 12562 Summary: std.algorithm.mul Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: Phobos Assignee: nobody puremagic.com Reporter: bearophile_hugs eml.cc I suggest to add a function "mul" similar to std.algorithm.sum to std.algorithm that computes the product of the given range: void main() { import std.stdio, std.range, std.algorithm, std.bigint; reduce!((a, b) => a * b)(1, iota(1, 10)).writeln; // 362_880 iota(1, 10).mul.writeln; // The same result. iota(1, 10).mul(1.0).writeln; // The same result, but of type double. BigInt[] a; a.mul.writeln; // Should print 1 } --
Apr 11 2014