Newsgroups: comp.lang.lisp From: hoey@zogwarg.etl.army.mil (Dan Hoey) Date: 8 May 91 15:44:21 GMT Subject: Re: How does one quote an atom in Sun CL (correction) char...@ai-cyclops.jpl.nasa.gov writes: >The following works as a general purpose quoting function for any LISP datum: >(defun kwote (thing) > (if (constantp thing) > thing > `(quote ,thing))) No. The CONSTANTP test is incorrect for constants that do not evaluate to themselves. For instance (KWOTE 'PI) -> PI fails the expected (EQL 'PI (EVAL (KWOTE 'PI))). The traditional way of defining KWOTE is (defun kwote (thing) `',thing) although the alternate definition (defun kwote (thing) (if (and (constantp thing) (eql thing (eval thing))) thing `',thing)) is functionally acceptable and arguably preferable. If you're about to lose your connection, you can try (DEFUN KWOTE (-\))`',-\))