Clojure - Anonymous Functions
An anonymous function is a function which has no name associated with it. Following is an example of an anonymous function.
(ns clojure.examples.hello (:gen-class)) ;; This program displays Hello World (defn Example [] ((fn [x] (* 2 x)) 2)) (Example)
The above example defines a function which takes a value of x as an argument and the function itself multiples the value of the argument by 2.
clojure_functions.htm
Advertisements