From 6c2f2bc60de60a58d23b1201c5686426979ab5a5 Mon Sep 17 00:00:00 2001 From: Stevie Strickland Date: Sun, 14 Sep 2008 06:27:22 +0000 Subject: [PATCH] One more time. Oh, well. svn: r11745 --- collects/mzlib/scribblings/contract.scrbl | 38 ++++----- .../scribblings/reference/contracts.scrbl | 84 +++++++++---------- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/collects/mzlib/scribblings/contract.scrbl b/collects/mzlib/scribblings/contract.scrbl index 1b3a81ec9c..3478296362 100644 --- a/collects/mzlib/scribblings/contract.scrbl +++ b/collects/mzlib/scribblings/contract.scrbl @@ -112,22 +112,22 @@ where the reference to the defined variable occurs. Instead, it uses the source location of the reference to the variable as the name of that definition. -@interaction[#:eval (parameterize ([sandbox-output 'string] - [sandbox-error-output 'string] - [sandbox-eval-limits #f]) - (make-evaluator 'mzscheme)) - (require mzlib/contract) - (define/contract f - (-> number? number?) - (lambda (x) (+ x 1))) - (define/contract g - (-> number? number?) - (lambda (x) (f #t))) - (define/contract i - (-> number? number?) - (lambda (x) - (if (number? x) (i #t) 0))) - (f 4) - (f #t) - (g 4) - (i 3)]} +@examples[#:eval (parameterize ([sandbox-output 'string] + [sandbox-error-output 'string] + [sandbox-eval-limits #f]) + (make-evaluator 'mzscheme)) + (require mzlib/contract) + (define/contract f + (-> number? number?) + (lambda (x) (+ x 1))) + (define/contract g + (-> number? number?) + (lambda (x) (f #t))) + (define/contract i + (-> number? number?) + (lambda (x) + (if (number? x) (i #t) 0))) + (f 4) + (f #t) + (g 4) + (i 3)]} diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index 7a6856129b..eb83a88d43 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -662,30 +662,30 @@ exported without a contract. The @scheme[blame-id] is used for the positive positions of contracts paired with exported @scheme[id]s. Contracts broken within the @scheme[with-contract] @scheme[body] will use the -@scheme[blame-id] for their negative position.} +@scheme[blame-id] for their negative position. -@interaction[(require scheme/contract) - (with-contract odd-even - ([odd? (-> number? boolean?)] - [even? (-> number? boolean?)]) - (define (odd? n) - (if (zero? n) #f (even? (sub1 n)))) - (define (even? n) - (if (zero? n) #t (odd? (sub1 n))))) - (even? 4) - (odd? "foo") - (with-contract bad-internal-call - ([f (-> number? number?)] - [g (-> number? number?)]) - (define (f x) - (+ x 1)) - (define (g x) - (if (zero? x) #t (f #t)))) - (f 4) - (f 'a) - (g "foo") - (g 0) - (g 3)] +@examples[(require scheme/contract) + (with-contract odd-even + ([odd? (-> number? boolean?)] + [even? (-> number? boolean?)]) + (define (odd? n) + (if (zero? n) #f (even? (sub1 n)))) + (define (even? n) + (if (zero? n) #t (odd? (sub1 n))))) + (even? 4) + (odd? "foo") + (with-contract bad-internal-call + ([f (-> number? number?)] + [g (-> number? number?)]) + (define (f x) + (+ x 1)) + (define (g x) + (if (zero? x) #t (f #t)))) + (f 4) + (f 'a) + (g "foo") + (g 0) + (g 3)]} @defform*[[(define/contract id contract-expr init-value-expr) (define/contract (head args) contract-expr body ...+)]]{ @@ -701,25 +701,25 @@ of the contract. It is equivalent to wrapping a single @scheme[define] with a @scheme[with-contract] form that pairs the @scheme[contract-expr] with the bound identifier. -@interaction[(require scheme/contract) - (define/contract a number? #t) - a - (define/contract (f x) - (-> number? number?) - (+ x 1)) - (f 4) - (f #t) - (define/contract (g #:foo [x 3] . y) - (->* () (#:foo number?) #:rest (listof number?) number?) - (+ x (apply + y))) - (g) - (g #:foo #t) - (g 1 2 3 'a) - (define/contract i - (-> number? number?) - (lambda (x) - (if (number? x) (i #t) 0))) - (i 3)]} +@examples[(require scheme/contract) + (define/contract a number? #t) + a + (define/contract (f x) + (-> number? number?) + (+ x 1)) + (f 4) + (f #t) + (define/contract (g #:foo [x 3] . y) + (->* () (#:foo number?) #:rest (listof number?) number?) + (+ x (apply + y))) + (g) + (g #:foo #t) + (g 1 2 3 'a) + (define/contract i + (-> number? number?) + (lambda (x) + (if (number? x) (i #t) 0))) + (i 3)]} @defform*[[(contract contract-expr to-protect-expr positive-blame-expr negative-blame-expr)