[Issue 12272] and(), or(), xor() to compose predicates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 28 06:18:48 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12272
--- Comment #3 from bearophile_hugs at eml.cc 2014-02-28 06:18:45 PST ---
(In reply to comment #2)
> Lambdas make this pretty easy...
>
> names.filter!(s => s.startsWithJ && s.fourLetterLong)
>
> Slightly longer, but _much_ more flexible.
With those templates you can define a new predicate in point-free style
(std.functional.compose!() does something similar for arbitrary functions):
alias two = and!(startsWithJ, fourLetterLong);
With lambdas it becomes similar to:
enum two = (in string s) => s.startsWithJ && s.fourLetterLong;
So are you suggesting to close down this ER because it's not useful enough?
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list