[racket] on-key question

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Mar 14 13:40:17 EDT 2012

Here is one way to see what John means: 

1. Experiment with strings and how they represent key strokes in the interactions area of DrRacket: 

> (string-length "\t")
> (key=? "\t" "\t")
> (key=? "\t" "a")

2. Define a key-handler function 

3. Also explore whether it does the right thing in the interactions area: 

> (key-handler "hello" "\t")
> (key-handler "hello" "a")

[the above are 'live' experiments, copied and pasted here]

On Mar 14, 2012, at 1:32 PM, John Clements wrote:

> On Mar 14, 2012, at 9:05 AM, Roelof Wobben wrote:
>> As far as I can see I have three different things.
>> 1) Input is a character.    Append it to the world.
>> 2) Input is a  like this one /t . Do nothing.
>> 3) Input is a  double or more string like right. Do nothing.
>> I have to figure out how i can distinct the 1 and 2 from each other.  They both have lenght 1.
> I'm a bit confused by this message, but I'm going to go out on a limb and suggest that both this question and your prior one will be self-answered if you write down test cases for your situations 1, 2, and 3 above.
> John Clements
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Posted on the users mailing list.