title: on-key in racket
body: <pre><code>(require 2htdp/image)
  (require 2htdp/universe)
  
  (define (render t)
    (text (number-&gt;string t) 10 "red"))
  
  (define (ball-image t)
    (place-image (circle 10 "solid" "red")
                150
                150
  
                 (empty-scene 300 300)))
  
  
  
  (define (change w a-key)
    (cond
      [(key=? a-key "left")  (ball-image w)]
      [(key=? a-key "right") (ball-image w )]
      [(= (string-length a-key) 1) w] 
      [(key=? a-key "up")    (ball-image w )]
      [(key=? a-key "down")  (ball-image w )]
      [else w]))
  
  
  
  (big-bang 100
            (on-tick sub1 )
            (to-draw ball-image)
            (on-key change))
  </code></pre>
  
  <p>I am trying to get the red ball I have placed in the middle to  move up, down, left, or right. When I press any of the arrow keys, it says it expects a number but given an image. What am I doing wrong?</p>