[Issue 4405] all function - returns whether predicate is true for all elements in a range
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 7 15:10:54 PST 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4405
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #5 from bearophile_hugs at eml.cc 2011-02-07 15:08:28 PST ---
I have written a duplicated enhancement request: bug 5544
There I have asked an all() and any() that allow to write code as this:
import std.algorithm;
void main() {
auto items = [1, 7, 22];
bool r1 = all!q{a % 2}(items);
assert(!r1);
items = [1, 7, 21];
bool r2 = all!q{a % 2}(items);
assert(r2);
}
Instead of:
import std.algorithm;
void main() {
auto items = [1, 7, 22];
bool r1 = reduce!q{a && b}(true, map!q{a % 2}(items));
assert(!r1);
items = [1, 7, 21];
bool r2 = reduce!q{a && b}(true, map!q{a % 2}(items));
assert(r2);
}
--
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