Logo

Programming-Idioms

History of Idiom 189 > diff from v21 to v22

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

Version 21

2019-12-28, 02:15:19

Version 22

2019-12-28, 02:52:32

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)}