[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



A curious bug that GJC and BIL said might be worth mentioning.
(DEFMACRO PUSHSET (ELEMENT LIST)
   `(SETQ ,LIST (CONS ,ELEMENT ,LIST)))
does not have the same result as
(DEFMACRO PUSHSET (ELEMENT LIST)
   `(SETQ ,LIST (NCONC (NCONS ,ELEMENT) ,LIST)))
although, by all rights, it should behave identically. The example usage
under which it fails is a large LISP system of functions such that a trivial
demonstration of the problem is difficult. The observed behavior was as follows:
(PUSHSET '(A B C D) MYLIST)
=> ((A B C D) A B C D)
which is clearly incorrect. GJC confirmed this by using (CL:CL)
although I do not know what that is. When the second form of the macro was
performed, the correct action was the result.
(PUSHSET '(A B C D) MYLIST)
=> ((A B C D))
I hope this is helpful in making the world a better place to live.
If you want a practical demo, ask me and I will come over and show you.