Logo

Programming-Idioms

History of Idiom 247 > diff from v6 to v7

Edit summary for version 7 by programming-idioms.org:
Extra explicit statement: Keep all the elements that do satisfy p.

Version 6

2020-12-09, 12:11:38

Version 7

2020-12-09, 12:13:48

Idiom #247 Filter list in-place

Remove all the items from list x that don't satisfy the predicate p, without allocating a new list.

For languages that don't have mutable lists, refer to idiom #57 instead.

Idiom #247 Filter list in-place

Remove all the elements from list x that don't satisfy the predicate p, without allocating a new list.
Keep all the elements that do satisfy p.

For languages that don't have mutable lists, refer to idiom #57 instead.

Variables
x,p
Variables
x,p
Extra Keywords
keep conserve preserve mutable
Extra Keywords
keep conserve preserve mutable