OK, Dan's suggestion allows me to tell if a Maxima function has been
either
compiled or translated, but it doesn't tell me if a function has been
translated, but not compiled. To do this, I tried using
compiled-function-p
(defun $xcompile (f)
(cond ((symbolp f)
(let ((fp (mfuncall '$properties f)))
(if (or ($member '$function fp)
(and ($member '$transfun fp) (not (compiled-function-p
#'f))))
(mfuncall '$compile f)
(merror "I can't compile that!"))))
(t merror "I can't compile that!")))
(%i5) load("e:/functionp.lisp");
(%O5) e:/functionp.lisp
(%i6) xcompile(f);
I can't compile that!
-- an error. Quitting. To debug this try debugmode(true);
So far OK. Now define f
(%i7) f(x) := 0;
(%O7) F(X):=0
(%i8) xcompile(f);
Compiling gazonk0.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=2, Space=3, Speed=2
Finished compiling gazonk0.lsp.
(%O8) [F]
This is also OK -- now let's try xcompile(f) again,...
(%i9) xcompile(f);
Maxima encountered a Lisp error:
Error in FUNCTION [or a callee]: The function F is undefined.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
It seems that there is something wrong with my call to
compiled-function-p. Dipping down to Lisp
(%i10) to_lisp();
Type (to-maxima) to restart
MAXIMA>(compiled-function-p #'$f) <---- seems OK
T
What's the story? A function something like my xcompile might
be useful for numerical integration and etc.
(%i12) build_info();
Maxima version: 5.9.1.1cvs
Maxima build date: 11:37 3/28/2005
host type: i686-pc-mingw32
lisp-implementation-type: Kyoto Common Lisp
lisp-implementation-version: GCL 2.6.5
(%O12)
Barton