Reputation: 7693
(map (fn [x] (func 1 2 x)) [0 1 2])
where func
takes 3 arguments can be written as (map #(func 1 2 %) [0 1 2])
for short. Is it possible to make it even more concise? Like in OCaml, (func 1 2)
itself is a function. I don't need to create a new one and pass it to map.
Upvotes: 1
Views: 52
Reputation: 17773
Clojure doesn't do auto-currying, so you can't just say (func 1 2)
, but you can use partial
:
(map (partial func 1 2) [0 1 2])
Upvotes: 5