[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Case sensitivity (was: CLtL, cleanups)
Date: Fri, 4 Jan 91 19:12 EST
From: barmar@Think.COM (Barry Margolin)
I found a better function than SI:RDTBL-TRANS. There's a *documented*
function SET-CHARACTER-TRANSLATION. The calling sequence is
set-character-translation from-char &optional (to-char nil) (readtable *readtable*)
If to-char is NIL then the character isn't translated. So, to get
case-sensitive reading, do
(loop for code from (char-code #\a) to (char-code #\z)
do (set-character-translation (code-char code)))
This function also does some sanity checking that SETF of SI:RDTBL-TRANS
bypasses; for instance, it won't let you set the translation of a
readmacro character (except to set it to translate to itself).
barmar
Beware that not all "Common Lisp" implementations have successfully (or
accurately) implemented the readtable mechanism. I have had trouble
with set-character-translation on other systems (Symbolics does it right
though).