Logo

Programming-Idioms

History of Idiom 189 > diff from v11 to v12

Edit summary for version 12 by andrezgz:
New Perl implementation by user [andrezgz]

Version 11

2019-09-27, 22:34:36

Version 12

2019-09-27, 23:27:30

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
Extra Keywords
map apply
Code
my @y = map { T($_) } grep { P($_) } @x;
Comments bubble
$_ inside grep block represents each element e of array x