(eq 'A 'a)
T
How come?
How can I turn on case sensitivity in LISP (FreeLISP)?
So that I get:
(eq 'A 'a)
NIL
Sent via Deja.com http://www.deja.com/
Before you buy.
In article <············@nnrp1.deja.com>, ············@my-deja.com
wrote:
> (eq 'A 'a)
> T
> How come?
> How can I turn on case sensitivity in LISP (FreeLISP)?
> So that I get:
> (eq 'A 'a)
> NIL
The Common Lisp ***reader*** does upcase
symbols by default. So internally above
symbols are upcase:
? (symbol-name 'a)
"A"
You can write symbols also this way:
? (symbol-name '\a)
"a"
Or
? (symbol-name '|Ho' mir ma 'ne Flasche Bier|)
"Ho' mir ma 'ne Flasche Bier"
Another option is to change the READTABLE CASE of the
readtable.
In the following example let's read an expression
from a string:
(let ((*readtable* (copy-readtable nil)))
(setf (readtable-case *readtable*) :preserve)
(read-from-string "(EQ 'A 'a)"))
it returns (EQ 'A '\a)
Rainer Joswig
--
Rainer Joswig, Hamburg, Germany
Email: ·············@corporate-world.lisp.de
Web: http://corporate-world.lisp.de/
One simple approach would be to try
(setf (readtable-case *readtable*) :invert)
--
Thomas A. Russ, USC/Information Sciences Institute ···@isi.edu
From: ············@my-deja.com
Subject: Re: MAKE LISP CASE SENSITIVE???
Date:
Message-ID: <8ui8ok$2i8$1@nnrp1.deja.com>
In article <···············@sevak.isi.edu>,
···@sevak.isi.edu (Thomas A. Russ) wrote:
>
> One simple approach would be to try
>
> (setf (readtable-case *readtable*) :invert)
>
Hmm. OK, but where do I type this? on the command line, before or after
running my program? Or do I place in one of the functions of my program?
TIA
Sent via Deja.com http://www.deja.com/
Before you buy.
You would want this to execute in the lisp image before you read in the
source files that you want to have case sensitive. Therefore, logical
places to put it are:
If you want it to be globally true:
(1) Type it as the first expression in the Listener after Lisp starts
up.
or (2) Put it in your lisp system's initialization file. This is a
file that Lisp environments load at startup. The name is system
dependent. Often something like init.lisp or lisp-init.lisp or
.cl-init.cl
This does do a global change. If you want changes to be more local
there is a bit more work to do with regard to making a copy of the
readtable and then binding the *readtable* variable around the forms
where you want this change to occur.
--
Thomas A. Russ, USC/Information Sciences Institute ···@isi.edu
* ············@my-deja.com
| How can I turn on case sensitivity in LISP (FreeLISP)?
This just _gotta_ be an insensitive troll.
#:Erik
--
Al-Gore-ism: a procedure for solving an electoral problem in a finite
number of steps that frequently involves repetition of an operation.
See also algorithm.