by 0PingWithJesus · 9y ago · 0 comments
(But the real problem with common lisp is that its version of (+ 2) is the ridiculously verbose (LAMBDA (x) (+ 2 x)) — far too many anonymous functions end up with more boilerplate than content. A decent reader macro might go a long way towards curing curry envy. If I remember correctly, it's [+ 2 _] in Paul Graham's Arc, not bad.)
If verbose expressions are a problem, normal macros or functions would be sufficient.
CL-USER 10 > (defmacro rlambda (fn &rest forms)
(let ((arg-sym (gensym "ARG-")))
`(lambda (,arg-sym)
(,fn ,@forms ,arg-sym))))
RLAMBDA
CL-USER 11 > (macroexpand-1 `(rlambda + 2))
(LAMBDA (#:ARG-804) (+ 2 #:ARG-804))
T
The 'real problem' is that many people have difficulties using and accepting a programmable programming language.Common Lisp simply can't approach the succinctness and elegance of currying without adding some syntax.
Your resistance is puzzling, btw. You're not having difficulties using and accepting a programmable programming language, are you?
(cut + 2 <>)
GNU Guile specifically has a curried definition syntax: (define ((foo x) y)
(list x y))
https://www.gnu.org/software/guile/manual/html_node/Curried-...Or you can bind "lambda" to another, shorter identifier.
But anyway, Lisp's goal isn't to be extremely terse, so it doesn't bother me.