Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Strangely, ANSI CL says that remove-if-not is deprecated.

That probably wouldn't be the case if it had been named retain-if or keep-if; the issue is likely the double negative.

A function which pares down a sequence to just those elements which match a predicate is very useful; why would you deprecate such a thing.



Probably because the idea of the standards group was that you already had REMOVE and COMPLEMENT, so there was no need for it.

These days the function is usually called filter, but I'm not sure it was a commonly used term then.


Even GNU make has $(filter ...) and $(filter-out ...).

It'a terrible name, by the way. A filter separates; it has two outputs. Does a function named filter return the filtrate or the residue? And I just had to look up filtrate to check which one of the two it refers to and what is the opposite term. From now on I will remember that there is residue captured in a filter, and filtrate is not that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: