Curried Functions
- Subject: Curried Functions
- From: Peter Danenberg
- Date: Mon, 18 Feb 2008 19:46:25 -0600
Currying works in Maxima from lisp:
:lisp (defun curry (function &rest args) (lambda (&rest more-args)
(apply function (append args more-args))))
:lisp (defun double (x) (funcall (curry #'* 2) x))
:lisp (double 5)
/* 10 */
but I can't seem to translate it into Maximese:
curry(f, [args]) := lambda([[x]], apply(f, append([args], x)));
double(x) := curry("*", 2)(x);
double(5);
/* f(args, 5) */
Is there a closure issue; verb-noun conflation; or something else I've
missed?