Subject: Re: Upper/Lower Case Question From: Erik Naggum <erik@naggum.no> Date: 1995/04/14 Newsgroups: comp.lang.lisp Message-ID: <19950414T181207Z.enag@naggum.no> [David J. Topper] | There were some posts concerning printing out upper and lower case | characters with *print-case* and ~(...~). But I want to preserve case | in symbol bindings. For example, how can I get around the following: | | >(setq x 'z) | Z | | >(setq y 'Z) | Z | | >(equal x y) | T | | I would like the last evaluation to return nil. assuming that you have thought through the consequences, (setf (readtable-case *readtable*) :preserve) will get you want you want, except that all builtin functions are now uppercase: CMU Common Lisp 17f, running on naggum.no * (setf (readtable-case *readtable*) :preserve) :PRESERVE * (SETQ X 'z) z * (SETQ Y 'Z) Z * (EQUAL X Y) NIL * (QUIT) the :invert readtable-case is possibly more interesting: CMU Common Lisp 17f, running on naggum.no * (setf (readtable-case *readtable*) :invert) :invert * (defvar x 'z) x * (defvar y 'Z) y * (list x y) (z Z) * (equal x y) nil * (setf (readtable-case *readtable*) :upcase) :UPCASE * (list x y) (Z |z|) * (quit) if you use longer than one-character symbol names, this will work a little more intuitively than in the above example. :) if you want only some symbols to preserve case, you might find it useful to investigate the escape characters. both \z and |z| will produce a symbol named the lowercase letter z. CMU CL has implemented all of this right. GCL does not support the function at all as of release 1.1. CLISP does not support :invert. (I'm continually amazed by the things that CLISP does and does not support. authentic quote from timezone.lsp: "Timezone for PRC not implemented - Don't forget that 10000 students were murdered by the government of the \"People's Republic of China\" in May 1989!" what next? "recycle" instead of "garbage-collect"?) #<Erik> -- sufficiently advanced political correctness is indistinguishable from irony