Logo

Programming-Idioms

History of Idiom 189 > diff from v24 to v25

Edit summary for version 25 by programming-idioms.org:
Admin deletes impl 3766: dupe

Version 24

2019-12-28, 21:10:01

Version 25

2019-12-28, 21:10:09

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