clojure.core/identity¶
Returns its argument.
Examples¶
Note by Jacolyte¶
I don't quite see the usefulness of this :P
Note by dturczanski¶
It's useful for example with -> macro when we eventually want to return its argument (in this case: state)
(defn example[state] (-> state update-function-1 update-function-2 identity))
Note by lancepantz¶
Here is another good example:
(some identity ((juxt :foo :bar) {:bar :b}))
equivalent to
(let [map {:bar b}] (or (:foo map) (:bar map)))
### Note by tlightsky
user=> (mapcat identity [[[0 1] [1 2]] [[11 12]]])
([0 1] [1 2] [11 12])
## See also
---
Content from [the matching ClojureDocs page](https://clojuredocs.org/clojure.core/identity), with authors
credited on each contribution.