Someone should fix these bugs in translate/compile:
(%i4) f() := lambda([s],s^s)$
(%i5) f()(3);
(%o5) 27 OK
(%i6) translate(f)$
(%i7) f()(3);
(%o7) 27 OK
(%i8) compile(f)$
Compiling C:/Users/Stavros/AppData/Local/Temp/gazonk_7896_0.lsp.
...
(%i9) f()(3);
Maxima encountered a Lisp error: ????
...
(%i10) ?funcall(f(),3); <<<<<<< should not be necessary
(%o10) 27
On Wed, Dec 7, 2011 at 06:28, Barton Willis <willisb at unk.edu> wrote:
>
> -----"Edwin Woollett" <woollett at charter.net> wrote: -----
>
> On Dec. 6, Barton Willis wrote:
> --------------
> >My favorite way to locally define a function is to use a lambda form.
>
> The Maxima compiler will not compile a lambda form--for example,
> f : compile(lambda([s],s^s)) does not work. The define method should
> allow for compilation; however, it is possible to do:
>
> (%i1) f() := lambda([s],s^s)$
> (%i2) compile(f)$
>
> (%i3) f();
> (%o3) #<compiled-closure 10ca7de4>
>
> (%i4) :lisp(funcall (mfuncall '$f) 6)
> 46656
>
> --Barton
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>