User:Ushkin N/Comparison of programming languages/Functional/Filter

Filter is a standard function for many programming languages, e.g., Haskell, OCaml, Standard ML, or Erlang. Common Lisp provides the functions  and. Scheme Requests for Implementation (SRFI 1) provides an implementation of filter for Scheme. C++ provides the algorithms  (mutating) and   (non-mutating); C++11 additionally provides   (non-mutating). Smalltalk provides the  method for collections. Filter can also be realized using list comprehensions in languages that support them.

In Haskell,  can be implemented like this:

Here,  denotes the empty list, and   denotes the concatenation operator used to create a new list from a given value and an existing list.