From c19b8a4f7c8afb8d98b8ec3d3af4b1a8b1f4fdf1 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Fri, 8 Feb 2013 14:05:46 -0700 Subject: [PATCH] Correct the contract in Example 3 to use and/c. Closes PR 13486. --- collects/scribblings/guide/contracts-examples/3-test.rkt | 5 ++++- collects/scribblings/guide/contracts-examples/3.rkt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/collects/scribblings/guide/contracts-examples/3-test.rkt b/collects/scribblings/guide/contracts-examples/3-test.rkt index ae3fd0f879..22f9059586 100644 --- a/collects/scribblings/guide/contracts-examples/3-test.rkt +++ b/collects/scribblings/guide/contracts-examples/3-test.rkt @@ -9,4 +9,7 @@ "dictionaries" (test-equal? "value for" 2 (value-for d 'b)) (test-false "has?" (has? (rem d 'b) 'b)) - (test-equal? "count" 3 (count d)))) + (test-equal? "count" 3 (count d)) + (test-case "contract check for put: symbol?" + (define d0 (initialize (flat-contract integer?) =)) + (check-exn exn:fail:contract? (lambda () (put d0 "a" 2)))))) diff --git a/collects/scribblings/guide/contracts-examples/3.rkt b/collects/scribblings/guide/contracts-examples/3.rkt index aa57e4ed89..10aa60a556 100644 --- a/collects/scribblings/guide/contracts-examples/3.rkt +++ b/collects/scribblings/guide/contracts-examples/3.rkt @@ -59,7 +59,7 @@ ;; via initialize. We could do the same via a key? parameter ;; (exercise). add key k with value v to this dictionary [put (->d ([d dictionary?] - [k (and symbol? (not-has? d))] + [k (and/c symbol? (not-has? d))] [v (dictionary-value? d)]) () [result dictionary?]