function | since v0.0-927 | clojure.core/constantly | Edit |
(constantly x)
Returns a function that takes any number of arguments and always returns x
.
(def ten (constantly 10))
(ten "hi")
;;=> 10
(ten 123)
;;=> 10
(ten :whatever)
;;=> 10
Returns a function that takes any number of arguments and returns x.
(defn constantly
[x] (fn [& args] x))