Logo

Programming-Idioms

History of Idiom 189 > diff from v14 to v15

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

Version 14

2019-09-28, 14:47:10

Version 15

2019-10-01, 15:34:00

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
y = x.each_with_object([]){|e, ar| ar << t(e) if p(e)}