On Nov 25, 2008, at 7:51 PM, Gustavo wrote:
The compiler macros for functions disjoin and conjoin are broken. For debugging purposes, I copied the code to a macro to see what was happening.
cl-user> (in-package :metatilities)
#<package "METABANG.UTILITIES">
utilities> (defmacro disjoin* (&whole form &rest fns)
(cond ((every #'(lambda (x) (or (symbolp x) (function-expression-p x))) fns)
(with-unique-names (args)
`#'(lambda (,args)
(or ,@(mapcar #'(lambda (x)
`(apply ,(extract-head-form x)
,args))
fns)))))
(t form)))
disjoin*
utilities> (macroexpand-1 '(disjoin* #'macro-char-p #'whitespace-p))
#'(lambda (#:|args/1399|)
(or (apply macro-char-p #:|args/1399|) (apply whitespace-p #:|args/1399|)))
t
I realized this bug trying to compile a function - sbcl complained about the variables macro-char-p and whitespace-p not to be defined. That makes me wonder: what is "extract-head-form" doing? It should be usefull only if you did something like:
(define-compiler-macro disjoin (fn &rest fns)
...
`(,(extract-head-form x) ,@args)
...
)
I.e., eliminating the funcalls (I saw that somewhere on cliki.net some time ago).And, by the way, I guess that, the way the function disjoin is being defined, I guess there is no way to do this (the argument list is only known in execution time).