[racket] on-key question
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")
1
> (key=? "\t" "\t")
#t
> (key=? "\t" "a")
#f
2. Define a key-handler function
3. Also explore whether it does the right thing in the interactions area:
> (key-handler "hello" "\t")
"hello"
> (key-handler "hello" "a")
"helloa"
>
[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