hum@cs.mcgill.ca (Herbert HUM) (05/07/91)
I am trying to port a program from a TI Explorer to a Sun running Sun
CL. In the program, I have a function which given an interned symbol
will generate the quoted version of the symbol.
e.g.: (quote-atom (intern (concatenate 'string "hello-" "there")))
would produce the result 'hello-there
The quote-atom function can be written on the Explorer by using the
sys:inhibit-displacing-flag set to 't before a macro is called.
Does anyone know how to code the quote-atom function in Sun CL?
Any help would be greatly appreciated. Thanks.
Herbert
hum@cs.mcgill.camiller@cs.rochester.edu (05/07/91)
Unless I misunderstand you, some variation of this should work on the
explorer and any other common lisp:
`(quote ,(intern ...))
Good luck,
--
----
Brad Miller U. Rochester Comp Sci Dept.
miller@cs.rochester.edu {...allegra!rochester!miller}barmar@think.com (Barry Margolin) (05/07/91)
In article <1991May6.205017.15237@cs.mcgill.ca> hum@cs.mcgill.ca (Herbert HUM) writes: >e.g.: (quote-atom (intern (concatenate 'string "hello-" "there"))) > would produce the result 'hello-there > >The quote-atom function can be written on the Explorer by using the >sys:inhibit-displacing-flag set to 't before a macro is called. > >Does anyone know how to code the quote-atom function in Sun CL? >Any help would be greatly appreciated. Thanks. Since Sun CL doesn't do displacing macros (it's generally disallowed in Common Lisp), I don't think anything special is needed to implement quote-atom. (defun quote-atom (atom) `(quote ,atom)) -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar
charest@ai-cyclops.jpl.nasa.gov (05/08/91)
In article <1991May6.205017.15237@cs.mcgill.ca> hum@cs.mcgill.ca (Herbert HUM) writes: >Does anyone know how to code the quote-atom function in Sun CL? >Any help would be greatly appreciated. Thanks. > The following works as a general purpose quoting function for any LISP datum: (defun kwote (thing) (if (constantp thing) thing `(quote ,thing))) -Len Charest
hoey@zogwarg.etl.army.mil (Dan Hoey) (05/08/91)
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 (-\))`',-\))