Logo

Programming-Idioms

History of Idiom 189 > diff from v19 to v20

Edit summary for version 20 by steenslag:
New Ruby implementation by user [steenslag]

Version 19

2019-11-16, 00:34:52

Version 20

2019-12-28, 02:15:18

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
Code
y = x.filter_map{|e| t(e) if p(e)}