Subject: Using lisp displa to view local variables
From: Edwin Woollett
Date: Tue, 26 Jul 2011 10:42:14 -0700
On July 23, 2011, Dieter Kaiser wrote:
*******************
There are a lot of more possibilities, e.g. an example with a
mtext-expression:
MAXIMA> (defun $display_value (x)
(displa `((mtext) ,x " = " ,(eval x))))
$DISPLAY_VALUE
MAXIMA> (display_value 'expr)
expr = a + b + c
NIL
**************************
I would like to use your approach to look at local
lisp variables inside a lisp function, but am having
trouble getting a bound local variable passed:
------------------------------------------------------
Maxima 5.24.0
using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
(%i1) load(mfiles);
(%o1) c:/work2/mfiles.mac
(%i2) print_lines("display.lisp",1,11)$
;;; display.lisp
(defun ldisplay (&rest xx)
(mapcar #'(lambda (s)
(displa `((mtext) ,s " = " ,(eval s))) ) xx))
(defun f1 ()
(let ((a1 'aa) (s1 "my string") (l1 '(a b c)))
(mtell "local")
(ldisplay 's1 'l1 'a1)
(mtell "bye")))
(%i3) load("display.lisp");
(%o3) display.lisp
(%i4) ?trace (?ldisplay);
(%o4) (ldisplay)
(%i5) :lisp (f1)
local
1> (LDISPLAY S1 L1 A1)
Maxima encountered a Lisp error:
Error in EVAL [or a callee]: The variable S1 is unbound.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i5)
--------------------------------------------------
Any suggestions for getting bound local variables passed
to ldisplay?
Ted Woollett
p.s. I am probably making a basic lisp programming error?