using define inside a function



-----"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