[plt-scheme] Uppercase symbol handling

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Feb 2 14:19:05 EST 2005

read-case-sensitive is a parameter of the reader. If #t, the reader
implicitly downcases symbols (otherwise it leaves them alone). So,
you're setting the parameter after the reader is already finished.

If you changed your eq? tests to:

  (eq? (car l) (read (open-input-string "Item")))
  (eq? (car l) (read (open-input-string "item")))

you'll see the behavior you expect.

Also, if you prefix your module with #cs, you'll get what you expect.

Note that v299 has case-sensitivity on by default.

Robby

At Wed, 2 Feb 2005 19:18:31 -0000 (WET), "Paulo Jorge de Oliveira Cantante de Matos" wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Hi all,
> 
> I usually use everything lowercase by default but I'm reading
> xml from the net so some symbol just show up as uppercase. I'm
> getting somewhat confused with handling some issues. Can
> someone explain the behaviour of the next 2 interactions? (with
> module language enabled)
> (module test mzscheme
> 
>   (read-case-sensitive #t)
> 
>   (define test
>     (lambda (l)
>       (if (eq? (car l) 'Item)
>           (display "OK")
>           (display "Not OK"))))
> 
>   (define test1
>     (lambda (l)
>       (if (eq? (car l) 'item)
>           (display "OK")
>           (display "Not OK"))))
> 
>   )
> > (test '(Item a b c))
> Not OK
> > (test1 '(Item a b c))
> Not OK
> 
> 
> Why?
> 
> Cheers,
> 
> -- 
> Paulo Jorge Matos - pocm at sat inesc-id pt
> Engº de Informática e Computadores
> INESC-ID - Grupo SAT - MathSAT



Posted on the users mailing list.