Hacker News new | past | comments | ask | show | jobs | submit
I've never run into a generic "filter" function which keeps only the non-matching elements.
Smalltalk has #reject: which does that. You could, of course, just wrap a not around the test in the closure, but sometimes reject with a well-named predicate is easier to read.

bsnpApproved := tvShows reject: [ :eachShow | eachShow hasNaughtyContent ].

Common Lisp's filter is remove-if which works this way.

(It also has remove-if-not but that's deprecated and if you use it your code smells.)

loading story #49738594