analog of fundef for Maxima functions defined in lisp file
Subject: analog of fundef for Maxima functions defined in lisp file
From: Edwin Woollett
Date: Sat, 18 Jun 2011 11:35:18 -0700
On June 17, 2011, Raymond Toy wrote:
----------------------------------------
I'm not aware of any such thing in maxima. But you could try
:lisp (function-lambda-expression #'$rename1)
This isn't guaranteed to return anything, but for many Lisps it will
return the function. For example, cmucl will return
(LAMBDA (MFROM MTO)
(BLOCK $RENAME1
(CONS '(MLIST SIMP) (MULTIPLE-VALUE-LIST (RENAME-FILE MFROM MTO)))))
This definition might work for you:
(defun $lispfundef (f)
(print (function-lambda-expression (coerce f 'function)))
t)
----------------------------------------
Thanks for the suggestion.
It looks like GCL doesn't have function-lambda-expression defined
(despite Steele:common lisp the language, saying it was voted into CL
in 1989). There is also no mention in the CL Cookbook.
------------------------------
Maxima 5.24.0 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
2011-06-18
(%i1) printfile("lispfundef.lisp")$
;;;; lispfundef.lisp
(defun f1 (x) (+ 1 x))
(defun $f2 (x) (+ 1 x))
(defun $lispfundef (f)
(print (function-lambda-expression (coerce f 'function)))
t)
(%i2) load("lispfundef.lisp");
(%o2) lispfundef.lisp
(%i3) :lisp (function-lambda-expression f1)
Maxima encountered a Lisp error:
Error in PROGN [or a callee]: The function FUNCTION-LAMBDA-EXPRESSION is
undefined.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
--------------------
So maybe, a handmade lisp function to do the job
instead of function-lambda-expression?
Ted Woollett