Update of /project/cl-utilities/cvsroot/cl-utilities In directory common-lisp.net:/tmp/cvs-serv5183
Modified Files: compose.lisp Log Message: Fixed subtle bug in COMPOSE compiler macro. It was optimizing too much, causing lexical definitions to be used when, strictly speaking, funcall-time dynamic values should have been used.
Date: Tue May 10 21:45:38 2005 Author: pscott
Index: cl-utilities/compose.lisp diff -u cl-utilities/compose.lisp:1.1.1.1 cl-utilities/compose.lisp:1.2 --- cl-utilities/compose.lisp:1.1.1.1 Mon May 9 23:26:29 2005 +++ cl-utilities/compose.lisp Tue May 10 21:45:34 2005 @@ -34,19 +34,12 @@ ;; out and some things written as direct function calls. ;; Example: (compose '1+ #'2* '1+) => (LAMBDA (X) (1+ (2* (1+ X)))) (define-compiler-macro compose (&rest functions) - (labels ((quoted-symbolp (x) - (and (listp x) - (eql (first x) 'quote) - (symbolp (second x)))) - (sharp-quotedp (x) + (labels ((sharp-quoted-p (x) (and (listp x) (eql (first x) 'function) - (symbolp (second x)))) - (directly-callable-p (x) - (or (quoted-symbolp x) - (sharp-quotedp x)))) + (symbolp (second x))))) `(lambda (x) ,(reduce #'(lambda (fun arg) - (if (directly-callable-p fun) + (if (sharp-quoted-p fun) (list (second fun) arg) (list 'funcall fun arg))) functions