Zap a bunch more `define-contract' forms.

svn: r15971
This commit is contained in:
Mike Sperber 2009-09-11 09:38:59 +00:00
parent ed269cc43b
commit b6ca1e1673
3 changed files with 11 additions and 9 deletions

View File

@ -151,13 +151,14 @@
#'(at ?param (property ?accessor ?param))))
(syntax->list #'(our-accessor ...))
(syntax->list #'(?param ...)))))
#'(define-contract ?type-spec
#'(define ?type-spec
(contract
(combined (at ?type-name (predicate real-predicate))
component-contract ...))))
component-contract ...)))))
(_
;; we use real-predicate to avoid infinite recursion if a contract
;; for ?type-name using ?predicate is inadvertently defined
#'(define-contract ?type-name (predicate real-predicate))))))
#'(define ?type-name (contract (predicate real-predicate)))))))
(with-syntax ((defs
(stepper-syntax-property
(syntax/loc x defs) 'stepper-skip-completely #t))

View File

@ -141,10 +141,11 @@ Vertrag.
Aus der Datendefinition entsteht eine Vertragsdefinition folgender Form:
@schemeblock[
(define-contract ctr
(define ctr
(contract
(mixed #,(elem (scheme ctr) (subscript "1"))
...
#,(elem (scheme ctr) (subscript "n"))))
#,(elem (scheme ctr) (subscript "n")))))
]
Wenn die Prädikate für die einzelnen Sorten @elem[(scheme pred?)

View File

@ -191,7 +191,7 @@
(test-case
"predicate"
(define-contract integer (predicate integer?))
(define integer (predicate integer?))
(check-equal? (say-no (apply-contract integer 5)) 5)
(check-equal? (say-no (apply-contract integer "foo")) 'no))