universe now terminates properly

This commit is contained in:
Matthias Felleisen 2011-11-11 18:12:54 -05:00
parent 8c91d96c50
commit 5a3c78a998
3 changed files with 8 additions and 10 deletions

View File

@ -89,7 +89,7 @@
(define nxt (name (send universe get) a ...))
(define-values (u mails bad)
(if (stop-the-world? nxt)
(error 'stop! "the universe stopped: ~e" (stop-the-world-world nxt))
(stop! (stop-the-world-world nxt))
(bundle> n nxt)))
(send universe set (format "value returned from ~a" 'name) u)
(unless (boolean? to-string) (send gui add (to-string u)))

View File

@ -2,12 +2,8 @@
(require 2htdp/universe 2htdp/image)
(with-handlers ((exn? (lambda (w)
(unless (string=? "stop!: the universe stopped: 3" (exn-message w))
(raise w)))))
(universe 0
(on-tick (lambda (w) (make-bundle (add1 w) '() '())) 1/28 3)
(on-msg void)
(on-new cons))
(error "the universe didn't stop properly"))
(universe 0
(on-tick (lambda (w) (make-bundle (add1 w) '() '())) 1/28 3)
(on-msg void)
(on-new cons))

View File

@ -32,7 +32,9 @@
(on-new (lambda (w n) (make-bundle (cons n w) '() '())))
(on-tick
(lambda (w*)
(make-bundle w* (map (lambda (w) (make-mail w 'go)) w*) '())))
(make-bundle w* (map (lambda (w) (make-mail w 'go)) w*) '()))
1
3)
(on-msg
(lambda (state iw msg)
;; display the received prefabbed struct's content