5
votes

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

(defn just-val [x] x)

?

1
It's an interesting question. Is this for parameter checking?octopusgrabbus
i need to either return a value untouched or to apply a function to it, so i can pass the function to apply that's either a function doing something or (identity), as learned by ollb answer :)pistacchio

1 Answers

10
votes

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

user=> (identity 4)
4