https://d.puremagic.com/issues/show_bug.cgi?id=12272

           Summary: and(), or(), xor() to compose predicates
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2014-02-27 03:14:00 PST ---
In Java8 there are functions like and() or() xor() that are handy to compose
predicates:

Predicate<String> startsWithJ = (n) -> n.startsWith("J");
Predicate<String> fourLetterLong = (n) -> n.length() == 4;
names.stream().filter(startsWithJ.and(fourLetterLong))

In D:

auto startsWithJ = (string n) => n.startsWith("J");
auto fourLetterLong = (string n) => n.length == 4;
names.filter!(and!(startsWithJ, fourLetterLong))

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

Reply via email to