;; constantly returns a function which always returns the same value (map (constantly 9) [1 2 3]) user=> (9 9 9) (map (constantly (rand-int 100)) [:a :b :c]) user=> (43 43 43)
(defn constantly
"Returns a function that takes any number of arguments and returns x."
{:added "1.0"
:static true}
[x] (fn [& args] x))
Comments top
No comments for constantly. Log in to add a comment.