Clojure – Higher Order Functions

Clojure higher order functions

In this guide, we will discuss 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

Example

Following is an example code of the higher order function.

(filter even? (range 0 10))

Output

The above program produces the following output.

(0 2 4 6 8)

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply