" djhworld 450 days ago
link | parent |
Just reading the Shen example has made me question my choice of learning Clojure, with the simple example of partial application.
I dream for the day when you can just do (map (* 2) [1 2 3]) in Clojure
ataggart 450 days ago
link |
Why wait?
user=> (defmacro mapp [part coll & colls] `(map (partial ~@part) ~coll ~@colls)) #'user/mapp user=> (mapp (* 2) [1 2 3]) (2 4 6)
fogus 450 days ago
link |
Clojure provides function arity overloading and varargs, so automatic partial application is out. It's a tradeoff that Clojure alleviates by providing a lightweight function literal:
(map #(* % 2) [1 2 3])
An added advantage of Clojure's approach is that it's not limited to partial application on the last argument.
To provide implicit partial application or arity overloading and varargs is a fundamental shift in the way that the language operates. However, the gap between (in the direction Clojure->Shen only) one and the other is 2 characters, or a mapp macro like Alex showed. I'd make that trade any day of the week. " -- http://news.ycombinator.com/item?id=3129101