As suggested in a macro question I recently posted to SO , I encoded a macro called “fast” by calling a function (here is a separate code in pastebin) :
(defun main () (progn (format t "~A~%" (+ 1 2 (* 3 4) (+ 5 (- 8 6)))) (format t "~A~%" (fast (+ 1 2 (* 3 4) (+ 5 (- 8 6)))))))
This works in REPL, under SBCL and CMUCL:
$ sbcl This is SBCL 1.0.52, an implementation of ANSI Common Lisp. ... * (load "bug.cl") 22 22 $
Unfortunately, the code no longer compiles:
$ sbcl This is SBCL 1.0.52, an implementation of ANSI Common Lisp. ... * (compile-file "bug.cl") ... ; during macroexpansion of (FAST (+ 1 2 ...)). Use *BREAK-ON-SIGNALS* to ; intercept: ; ; The function COMMON-LISP-USER::CLONE is undefined.
So, it seems that when I run the macros of the "fast" call functions ("clone", "operation-p") during compilation, I run problems in Lisp compilers (it is checked both in CMUCL and SBCL).
Any ideas on what I'm doing wrong and / or how to fix it?
ttsiodras
source share