[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UPPER CASE & lower case



>Well, here is another novice question.
>I have to deal with a case in which both Upper case and
>lower case alterntion has a significant meaning. 
>For example, 'Cat', 'CAT', 'cat' and even 'cAt' have to
>be distinguished from each other. The obvious problem is
>that MCL does not recognize this difference. 
>Now what should I do to teach this silly machine to recognize
>'T' instead of 't'.
>Any suggestion would be greatly appreciated.
>
>
>-- Wonchul

It is not clear from your description wheter you *have* to use
symbols or wheter you could use strings instead. If you can use
strings your problem is simple (see CLtL's chapter on strings)
so I will assume that you need symbols.

What you need is a new feature of readtables called READTABLE-CASE
(see page 549 of CLtL2). With it you can do something like
(SETF (READTABLE-CASE *READTABLE*) :INVERT) and then

? (list 'list 'LIST 'List 'LiST)
(list LIST List LiST)

Or (SETF (READTABLE-CASE *READTABLE*) :PRESERVE) but then you have to
type pre-existing symbols in upercase, i.e.

? (LIST 'list 'LIST 'List 'LiST)
(list LIST List LiST)

Guillaume Cartier
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290
E-Mail: cartier@math.uqam.ca