svn: r17115
This commit is contained in:
parent
ef194eb948
commit
aee5ba80d7
23
collects/2htdp/tests/stop.ss
Normal file
23
collects/2htdp/tests/stop.ss
Normal file
|
@ -0,0 +1,23 @@
|
|||
;; The first three lines of this file were inserted by DrScheme. They record metadata
|
||||
;; about the language level of this file in a form that our tools can easily process.
|
||||
#reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname test-stop) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
|
||||
|
||||
(require 2htdp/universe)
|
||||
|
||||
;; on RETURN stop
|
||||
|
||||
(define (main debug?)
|
||||
(big-bang ""
|
||||
(on-key (lambda (w ke)
|
||||
(cond
|
||||
[(key=? ke "\r") (stop-with w)]
|
||||
[(= (string-length ke) 1)
|
||||
(string-append w ke)]
|
||||
[else w])))
|
||||
(state debug?)
|
||||
(on-draw (lambda (w)
|
||||
(place-image
|
||||
(text w 22 'black)
|
||||
3 3
|
||||
(empty-scene 100 100))))))
|
||||
|
|
@ -8,6 +8,6 @@
|
|||
(big-bang 0 (stop-when zero?) (on-tick add1))
|
||||
|
||||
"does big bang stop when the initial world is a stop world?"
|
||||
(big-bang (STOP! 0) (on-tick add1))
|
||||
(big-bang (stop-with 0) (on-tick add1))
|
||||
|
||||
(define-struct stop (x))
|
||||
(define-struct stop (x))
|
||||
|
|
Loading…
Reference in New Issue
Block a user