Logo

Programming-Idioms

History of Idiom 189 > diff from v18 to v19

Edit summary for version 19 by timepp:
New D implementation by user [timepp]

Version 18

2019-11-12, 22:56:10

Version 19

2019-11-16, 00:34:52

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements e of list x that match the predicate P.

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements e of list x that match the predicate P.

Extra Keywords
map apply satisfy
Extra Keywords
map apply satisfy
Imports
import std.algorithm;
Code
y = x.filter!(P).map!(T);
Doc URL
https://dlang.org/phobos/std_algorithm_iteration.html#.filter
Demo URL
https://ideone.com/Lk1Tzs