pistacchio
pistacchio

Reputation: 58953

Clojure: just return the value

Is there any Clojure built-in function that just returns the value being passed to it? The equivalent of

(defn just-val [x] x)

?

Upvotes: 6

Views: 1011

Answers (1)

ollb
ollb

Reputation: 1464

Yes there is the identity function: http://clojuredocs.org/clojure_core/clojure.core/identity

user=> (identity 4)
4

Upvotes: 11

Related Questions