Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 694 Bytes

anonymous-functions.md

File metadata and controls

21 lines (12 loc) · 694 Bytes

Anonymous functions

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))

Hint::

defn is a macro that combines of both def and fn. The defn macro to hide the details of definition of a function using fn.