Correct the contract in Example 3 to use and/c.
Closes PR 13486.
This commit is contained in:
parent
670efed007
commit
c19b8a4f7c
|
@ -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))))))
|
||||
|
|
|
@ -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?]
|
||||
|
|
Loading…
Reference in New Issue
Block a user