4 ms·
Clojure[0] and Anarki[1] (public fork of Arc) both provide a way to do this (with more than one argument as well). They both have syntax for a "literal function
by malisper 12y ago
Clojure[0] and Anarki[1] (public fork of Arc) both provide a way to do this (with more than one argument as well). They both have syntax for a "literal function". Your second example would become:
Arc/Anarki:
[format-names2 "John" _ "Jones"] which expands to (fn (_) (format-names2 "John" _ "Jones"))
Clojure:
#(format-names2 "John" % "Jones") which expands to (fn (%) (format names2 "John" % "Jones"))
Then for a function of two arguments that curried the middle one:
Anarki:
[format-names2 _1 "Paul" _2] which expands to (fn (_1 _2) (format-names2 _1 "Paul" _2))
Clojure:
#(format-names2 %1 "Paul" %2) which expands to (fn [%1 %2] (format-names2 %1 "Paul" %2))
[0] http://clojure.org/reader http://clojure.org/reader
[1] https://github.com/arclanguage/anarki/blob/master/CHANGES/make-br-fn https://github.com/arclanguage/anarki/blob/master/CHANGES/ma...
- mikeash 12y agoI should have known that if I can imagine a language feature, it will already be implemented in the Lisps....