;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname 14.2.1) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) (require picturing-programs) ; Exercises 14.2.1 (define WIDTH 500) (define HEIGHT 100) ; Model: a number, increasing by 1 each second ; Tick handler: add1 ; Draw handler show-num-at-x: number -> image ; written in exercise 10.2.5 ; key-handler stop-on-key : number key -> number (check-expect (stop-on-key 24 "whatever") (stop-with 24)) (define (stop-on-key model key) ; model number ; key whatever this is (ignore) (stop-with model) ) (big-bang 0 (check-with number?) (on-tick add1 1) (on-draw show-num-at-x) (on-key stop-on-key))