[racket] on-key question

From: Roelof Wobben (r.wobben at home.nl)
Date: Thu Mar 15 17:29:40 EDT 2012

2. Define a key-handler function
>  This is what I made :
>
> ; AllKeys String -> AllKeys
> ; add ke to w, the state of the world
> (define (key-handler w ke)
>   (cond
>     [ (key=? ke "\t") w]
>     [ (key=? ke "\r") w]
>     [ (key=? ke " ") w]
>     [ (key=? ke "\b") w]
>     [ (>( string-lenght ke) 1) w
>     [else (string-append w ke)]))
>

No more remarks or learning points.

Roelof


Posted on the users mailing list.