Clojure - Higher Order Functions

Higher-order functions (HOFs) are functions that take other functions as arguments. HOFs are an important functional programming technique and are quite commonly used in Clojure. One example of an HOF is a function that takes a function and a collection and returns a collection of elements that satisfy a condition (a predicate). In Clojure, this function is called clojure.core/filter


Following is an example code of the higher order function.

(filter even? (range 0 10))


The above program produces the following output.

(0 2 4 6 8)