Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!relay.nswc.navy.mil!zogwarg!hoey From: hoey@zogwarg.etl.army.mil (Dan Hoey) Newsgroups: comp.lang.lisp Subject: Re: How does one quote an atom in Sun CL (correction) Summary: Quotes, constants, and silliness Message-ID: <657@zogwarg.etl.army.mil> Date: 8 May 91 15:44:21 GMT References: <1991May6.205017.15237@cs.mcgill.ca> <1991May7.181305.1973@jpl-devvax.jpl.nasa.gov> Organization: Naval Research Laboratory, Washington, DC Lines: 27 In article <1991May7.181305.1973@jpl-devvax.jpl.nasa.gov> charest@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 (-\))`',-\))