Call a curried function directly, without funcall
Hi all,
Currently a function curried with Alexandria's curry
must be called with funcall
. However it is possible to set the new function's symbol-function
so that we can do without funcall. Illustrated on https://lispcookbook.github.io/cl-cookbook/functions.html#with-the-alexandria-library:
(defun adder (foo bar)
"Add the two arguments."
(+ foo bar))
(defvar add-one (alexandria:curry #'adder 1) "Add 1 to the argument.")
(funcall add-one 10) ;; => 11
(setf (symbol-function 'add-one) add-one)
(add-one 10) ;; => 11
I suggest to write a new function that would use this. (Called fcurry
?) Will you welcome a PR or have you big concerns about that ?
edit: and given that we still can use funcall
, shall we put this into curry
directly ?
regards