subst(lambda ...), was: multiple evaluations & integrate



On 2013-06-14, Barton Willis <willisb at unk.edu> wrote:

> Substitute allows replacing a function with a CL lambda form.  A more
> consistent substitute might break this. This substitute  feature isn't
> documented (unless reading the source is documentation :).

Well, I'm willing to fix up any code which stops working because it
relies on undocumented irregularities ...

I notice that Maxima isn't very comfortable with Lisp functions (as
opposed to Lisp function names, which don't cause any trouble). E.g.

(%i1) :lisp (defun $foo (x) (m* 2 x))
$FOO
(%i1) foo(1);
(%o1)                                  2 <<<< OK
(%i2) :lisp (defparameter $bar (symbol-function '$foo))
$BAR
(%i2) bar(1);
Maxima encountered a Lisp error: <<<< oops!
 symbol

(%i3) :lisp (defparameter $baz #'(lambda (x) (m* 2 x)))
$BAZ
(%i3) baz(1);
Maxima encountered a Lisp error: <<<< oops!
 symbol


Seems like stuff like that should work, shouldn't it?

best

Robert Dodier