Logo

Programming-Idioms

History of Idiom 189 > diff from v23 to v24

Edit summary for version 24 by programming-idioms.org:
Admin deletes impl 3767: dupe

Version 23

2019-12-28, 02:54:27

Version 24

2019-12-28, 21:10:01

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