To understand the colnew wrapper i have written a small program, and i am
puzzled by a small glitch in the interface between maxima and lisp (if it is
relevant, my maxima is compiled with cmucl) The problem is that the same
call works in (%i3) below, doesn't work in (%i4) but works in (%i5)
after having compiled f. What is the explanantion of this behaviour,
please?
niobe% maxima
(%i1) f(x):=[x^2,x^3];
2 3
(%o1) f(x) := [x , x ]
(%i2) load("essai.lisp");
(%o2) essai.lisp
(%i3) ?conversion(f);
(%o3) {Array: #(25.0 125.0)}
(%i4) :lisp(conversion #'$f)
Maxima encountered a Lisp error:
Error in FDEFINITION: the function $F is undefined.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
(%i4) compile(f);
(%o4) [f]
(%i5) :lisp(conversion #'$f)
#(25.0 125.0)
NIL
niobe% cat essai.lisp
;; reduced version of the colnew wrapper
(in-package :maxima)
(defun conversion (f)
(flet ((fsub ($x f-array)
(let ((res (mcall f $x)))
(loop for k from 0
for ff in (cdr res)
do
(setf (aref f-array k) ($float ff)))
(values f-array nil))))
(let (($x 5.0)(f-array (make-array 2 :initial-element 0.0 )))
(fsub $x f-array))))
--
Michel Talon