Newsgroups: comp.lang.lisp.x
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech2!swrinde!newsfeed.internetmci.com!in2.uu.net!usc!ccnet.com!boo!netcom.com!mayer
From: mayer@netcom.com (Niels P. Mayer)
Subject: Re: Case sensitivity
Message-ID: <mayerDIu5EF.8As@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <49cu4i$146@cc.tut.fi>
Date: Thu, 30 Nov 1995 02:54:15 GMT
Lines: 66
Sender: mayer@netcom4.netcom.com

In article <49cu4i$146@cc.tut.fi>, tek@cs.uta.fi (Teppo Kuusisto) writes:
> I try to use case sensitive fields in xlisp (winterp), but i can't despite
> the settings of *READTABLE-CASE*. I am using xlisp 2.1d.
> What should i do?
> Sorry if this is stupid question, but I am beginner with lisp.
> 
> X> ( pp *readtable-case* )
> :PRESERVE
> T
> X> ( setq testlist '(Aa Bb Cc))
> (AA BB CC)
> X> ( prin1 testlist )
> (AA BB CC)(AA BB CC)
> X> testlist
> (AA BB CC)
> X> 

For now, there's nothing you can do, since WINTERP
(http://www.eit.com/software/winterp) versions <= 2.03 didn't respond to
*readtable-case* because the version of XLISP used (something around
patchlevels 2.1c/d with other random patches thrown in) didn't implement
case sensitive reading. If the docs mention that *readtable-case*
does exist, then you've just found a bug :-)...

Now here's the part that won't help you at all right now -- I have a new
unreleased version of WINTERP (version 2.10) which is based on XLISP
patched up to approximately 2.1g vintage. This version does implement case
sensitive reading, and a whole lot more:

X> (setq *readtable-case* :preserve)
:PRESERVE
X> (SETQ testlist '(Aa Bb Cc))
(Aa Bb Cc)
X> (PRIN1 testlist)
(Aa Bb Cc)(Aa Bb Cc)
X> testlist
(Aa Bb Cc)

Anyways, like I said in my previous posting here, I'm not going to have any
time to do a new release of WINTERP this year. Hopefully I can get one out
soon (offers of help, $$$, caffeine, a free NEC 4050H pentium notebook
computer, or free travel to exotic places may speed up the process...)

Until then you might consider something screwy like using strings to
represent the mixed case symbols, and use string= as a comparison function,
and an XLISP hashtable (MAKE-HASH-TABLE, GETHASH, HASH) to do lookups of
these string-based symbols. Alternately, you might reconsider what exactly
you're trying to represent anyways, since you may be using symbols for
something they shouldn't be used for (??).

Finally, for a quickie solution to your problem, you might consider using
the LISP escape sequence to allow you to enter a symbol with lowercase
characters in it, for example

X> (SETQ testlist '(|Aa| |Bb| |Cc|))
(Aa Bb Cc)
X> (SETQ *READTABLE-CASE* :UPCASE  *PRINT-CASE* :DOWNCASE)
:downcase
X> (SETQ testlist '(|Aa| |Bb| |Cc|))
(|Aa| |Bb| |Cc|)

Note that for WINTERP 2.03, you will only see the latter result...

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=  Niels Mayer   http://www.cyborganic.com/People/niels   mayer@netcom.com  =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
