- Reference: Anonymous Function
An anonymous function is a function that is defined without a name.
They are useful when you are only going to use the function once or you need to do something special within an expression.
Anonymous functions are often used as an argument to other functions.
The fn
function is used to define an anonymous function.
(fn [arguments]
(str "Some behaviour that uses " arguments))
defn
is a macro that combines of bothdef
andfn
. Thedefn
macro to hide the details of definition of a function usingfn
.