Problem with translate_file() in Maxima-5.25.1



On 9th Nov 2011, Robert Dodier wrote:

> Not sure what you mean by "program mode".
> Let's back up -- what are you trying to accomplish?

Sorry for not being clear. By "program mode" I mean "within a Maxima function".
Following rk, I am trying to write a Maxima function foo1 which will construct
and translate another function foo2, such that foo1 can also be translated. So:
        foo1(u,v):=block(
                define(funmake(foo2,[x,y]),x+y),
                translate(foo2),
                foo2(u,v));
Maxima interprets this OK. But after
        translate(foo1);
calling foo1(2,3) produces
 Error in APPLY [or a callee]: The function MDEFINE is undefined.
Since the interpreter can manage it, I thought that the solution to this was
to replace
                define(etc),
with
                ?meval(something),
but I didn't know what the something was. After receiving your reply, I
realised that it should be:
                ?meval('(define(funmake(foo2,[x,y]),x+y))),
Then, after translate(foo1), things work. If the translate(foo2) call is omitted,
things still work in Maxima-5.25.1, but -5.20.1 needs to be told that foo2 is a
function by calling it as apply(foo2,[u,v]), which produces an inconsequential
translator warning.
?meval() seems a useful way of dealing with expressions that the interpreter
handles, but the translator doesn't.

In answer to my query on how to translate and name an anonymous function,
Robert Dodier wrote:

> I suppose you could do something like:
>
> (defun $make_named_function (name body)
>  (let ((my-lisp-lambda ($translate body)))
>    (setf (symbol-function name) my-lisp-lambda)))
>
> Disclaimer: I didn't actually try the above code.

Unfortunately, calling make_named_function() produces
 Error in LET [or a callee]: The function $TRANSLATE is undefined.
Is this because $translate is a special evaluation form?
But, with an answer to the ?meval problem, I don't need this translation.

Thank you for your help,

Kevin Gregson