Am Freitag, den 22.07.2011, 15:20 -0700 schrieb Edwin Woollett:
> Is it possible to call $display (line 737, comm.lisp) from
> inside the Lisp interpreter?
>
> The definition starts with (defmspec $display (form) ...)
>
> I get a lisp error if I naively call it like a function:
> -----------------------------------------
> MAXIMA> (setf s1 "This is my string")
>
> "This is my string"
>
> MAXIMA> ($display s1)
>
> Maxima encountered a Lisp error:
>
> Error in EVAL [or a callee]: The function $DISPLAY is undefined.
>
> Automatically continuing.
> To reenable the Lisp debugger set *debugger-hook* to nil.
> ------------------------------------------------
The macro defmspec defines a special form of a Maxima function. One
possibility to use the function is to call Maximas evaluator directly:
MAXIMA> (setq $form '((mplus) $a ((mtimes) 2 $x)))
((MPLUS) $A ((MTIMES) 2 $X))
MAXIMA> (meval '(($display) $form))
form = 2*x+a
$DONE
MAXIMA> (setq $form "This is my string")
"This is my string"
MAXIMA> (meval '(($display) $form))
form = "This is my string"
$DONE
The definition of a special form is on the property list:
MAXIMA> (get '$display 'mfexpr*)
#<FUNCTION (LAMBDA (FORM)) {972ADA5}>
The following is executed by the evaluator and can be used directly too:
MAXIMA> (apply (get '$display 'mfexpr*) (cons `(($display) $form) nil))
form = "This is my string"
Dieter Kaiser