Subject: Re: Parsing strings into LISP syntax From: Erik Naggum <erik@naggum.no> Date: 1999/11/06 Newsgroups: comp.lang.lisp Message-ID: <3150919272860240@naggum.no> * "Pascal Saremsky" <ps360@columbia.edu> | I get the feeling I'm missing the essence of lisp here! well, just that INTERN is called by the Lisp reader when it sees a string of characters that doesn't match anything else. so when you write (defun times3 (x) (* x 3)) the Lisp reader has already interned the symbol for you, and (find-symbol "TIMES3") will return the symbol. at this point, we're getting too close for comfort to the Lisp reader's character case conversion algorithm, and you are well advised not to try to out-do it. for legacy reasons (a.k.a. "hysterical raisins"), the Lisp reader upcases; it could have downcased, it could have retained case; it upcases, but you don't have to do that. when you read that symbol as a string of characters, just call FIND-SYMBOL (or INTERN) on it directly, and the right symbol is returned. however, to get a symbol in Lisp with the same name, you must cause the Lisp reader to see the exact name, too. this essentially means that you have to cause INTERN not to do case conversion. using a very powerful Lisp reader mechanism, the read-time evaluator, you could do (defun #.(intern "times3") (x) (* x 3)) but we have special syntax for this common phenomenon: (defun |times3| (x) (* x 3)) you can actually cause the Lisp reader not to do case conversion, and this may be preferable in your own code. see the function READTABLE-CASE for the whole story. however, if you set up a case sensitive readtable for your Lisp code, remember that Common Lisp upcases, and you need to type in uppercase, too: (DEFUN times3 (x) (* x 3)) the aesthetics of this approach is, however, generally disputed. #:Erik -- Attention Microsoft Shoppers! MS Monopoly Money 6.0 are now worthless.