in reply to RFC: List::Extract

An idea as to naming inspiration:

Ruby has similar methods on Array called select! and reject! which are in place versions of select and reject. The latter pair work similar to Perl's grep (returning elements for which the block provided returns true (or for which it doesn't return true for reject)), whereas the bang-suffixed versions follow Ruby convention and diddle their argument in place to remove the affected elements.

(And for the curious, Ruby does have a a.grep( pattern ) method on the array but it works using the === comparison operator to check pattern === element rather than using a predicate block; if it's given a block it behaves like a map on the matching items. There is no grep! though, which is kinda strange seeing that the other filtering methods have mutators.)

Update: Oh wait, you're returning the removed elements as well. select! and reject! just return the newly changed array, or nil if no modifications were made. Duuur. Me not awake yet.

Never mind, this is actually more like partition (which takes a block and returns two arrays, one for elements for which the block returned true and the other for elements for which it returned false), but there's not a mutator variant of that.