[plt-scheme] Advanced Student Language (HtDP)

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Mar 24 07:51:47 EDT 2010





On Mar 23, 2010, at 10:36 PM, Daniel King wrote:

> The `case` form in the Advanced Student Language rejects dispatch over
> characters such as:
> 
> (case #\a
>  ((#\b) "You chose b!")
>  ((#\a) "You chose a!"))
> 
> Is this a feature?  #lang scheme allows me to use the character type,
> and I'd like to use it in ASL.
> 

You can: 

Welcome to DrScheme, version 4.2.5.1-svn21mar2010 [3m].
Language: Advanced Student.
> (if (char=? #\a #\b) 0 1)
1


> Furthermore, I tried adding
> 
> (require (rename-in scheme [case char-case]))
> (provide char-case)

Just provide case as char-case. 


> 
> to a lib.ss file and then adding
> 
> (require "lib.ss")
> 
> to the ASL file, which seems to allow character dispatch, but then it
> complains that an else clause is
> 
> bad syntax (not a datum sequence)
> 
> Any idea how I can get this working?
> 
> Thanks
> 
> -- 
> Dan King
> College of Computer and Information Science
> Northeastern University
> danking at ccs.neu.edu
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.