From bf409e6300e9658705f4b1b3728b5316d7789520 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 21 Sep 2010 08:55:23 -0500 Subject: [PATCH] fix nominal problem with hangman (signature-related change unless I miss my guess) --- collects/htdp/hangman.rkt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/collects/htdp/hangman.rkt b/collects/htdp/hangman.rkt index e02ecb32cc..c9565bc6a0 100644 --- a/collects/htdp/hangman.rkt +++ b/collects/htdp/hangman.rkt @@ -246,13 +246,20 @@ (set! uncover (lambda (a-word) ;; abstraction breaking hack. - (parameterize ([current-inspector (dynamic-require ''drscheme-secrets 'drscheme-inspector)]) + (parameterize ([current-inspector + (with-handlers ([exn:fail? + (λ (x) + (error + 'hangman + "only works from within DrRacket when using the teaching languages via the languages menu (original exn msg: ~s)" + (exn-message x)))]) + (dynamic-require ''drscheme-secrets 'drscheme-inspector))]) (unless (struct? a-word) (error 'hangman "expected a struct, got: ~e" a-word)) (let ([word-vec (struct->vector a-word)]) - (unless (= (vector-length word-vec) 4) + (unless (= (vector-length word-vec) 5) (error 'hangman "expected words to be structures with three fields, found ~a fields" - (- (vector-length word-vec) 1))) + (- (vector-length word-vec) 2))) (format "~a~a~a" (vector-ref word-vec 1) (vector-ref word-vec 2)