Problem with translate_file() in Maxima-5.25.1



On 11/9/11, Kevin Gregson <kd.gregson at btinternet.com> wrote:

> On comparing the .LISP files produced by 5.25.1 and 5.20.1, I noticed that
> in a number of places my 5.25.1 version has hashes where the 5.20.1 version has
> code.

Well, the presence of #'s in the translate_file output is governed
by a Lisp special (global) variables *PRINT-LEVEL* and *PRINT-LENGTH*.
It appears the values currently assigned to these aren't
suitable for the translator. Probably it is trivial to fix it:
we just need to wrap this around the output:

(let ((*print-level* nil) (*print-depth* nil))
  (declare (special *print-level* *print-depth*))
  (print foo))

where FOO is the translator output.

Maybe someone has already fixed that. I can't check it at the moment.

> Q1) How can MEVAL be used in program mode?

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

> Q2) Is there any way of translating an anonymous function and attaching a
> name to it?

Well, if I remember correctly, Maxima lambda expressions are
translated to Lisp lambda expressions.
If you want to a named function, 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.

Hope this helps --

Robert Dodier