[Issue 13546] New: std.functional.not for arrays too

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 27 14:27:30 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13546

          Issue ID: 13546
           Summary: std.functional.not for arrays too
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc

I suggest std.functional.not to accept arrays too (and associative arrays) and
not just functions:

void main() {
    import std.stdio: writeln;
    import std.algorithm: filter;
    import std.functional: not;
    auto keys = [1, 2, 1, 1, 1, 2, 3];
    auto arr = [true, true, false, true];
    auto r1 = keys.filter!(k => !arr[k]);
    r1.writeln; // Output: [2, 2]
    auto r2 = keys.filter!(not!arr);
    r2.writeln;
}

--


More information about the Digitalmars-d-bugs mailing list