clojure - Is there any macro to help make a function with one open argument? -
(map (fn [x] (func 1 2 x)) [0 1 2])
func
takes 3 arguments can written (map #(func 1 2 %) [0 1 2])
short. possible make more concise? in ocaml, (func 1 2)
function. don't need create new 1 , pass map.
clojure doesn't auto-currying, can't (func 1 2)
, can use partial
:
(map (partial func 1 2) [0 1 2])
Comments
Post a Comment