From: Kaz K. <ka...@as...> - 2003-03-08 04:47:53
|
I've known about this issue quite some time. It's either a bug, or there is some subtlety about backquotes that I don't understand. ;;; expected result: (FOO `(BAR (BAZ 'A A) (BAZ 'B B) (BAZ 'C C))) ;;; CLISP result: (FOO `(BAR NIL NIL NIL NIL)) (defun breaks-on-clisp () (let ((list '(a b c d))) `(foo `(bar ,@',(mapcar #'(lambda (sym) `(baz ',sym ,sym)) list))))) ;;; moving (mapcar ...) to a function fixes it: (defun factored-out (list) (mapcar #'(lambda (sym) `(baz ',sym ,sym)) list)) (defun does-not-break () (let ((list '(a b c d))) `(foo `(bar ,@',(factored-out list))))) It looks like backquote is confused; it's doing something wrong with the `(baz ',sym ,sym) even though that occurs in a doubly-unquoted context. You can see that MAPCAR iterates the right number of times, but the lambda is returning NIL for some bizarre reason. |