Version: 4.2.3
11 Anaphoric Contracts
Creates an “anaphoric” contract, using the
id+ ... as the
positive positions, and the
id- ... as the negative positions.
Anaphoric contracts verify that only values provided to a given
positive position flow out of the corresponding negative position.
Examples: |
|
> (f 1) |
1 |
> (f #f) |
#f |
> (f 17) |
(function f) broke the contract | (poly/c ((in out)) (-> |
|
in out)) | on f; expected <out>, given: 18 |
|
Produces a procedure contract that is like cnt, but any delayed
evalutation in cnt is re-done on every
application of the contracted function.
(memory/c | [ | #:name name | | | | | | | #:from from | | | | | | | #:to to | | | | | | | #:weak weak? | | | | | | | #:equal equal | | | | | | | #:table make-table]) | | → | | |
|
name : any/c = "memory/c" |
from : any/c = (format "~a:from" name) |
to : any/c = (format "~a:to" name) |
weak? : any/c = #t |
equal : (or/c 'eq 'eqv 'equal) = 'eq |
|
Produces a pair of contracts. The first contract remembers all values
that flow into it, and rejects nothing. The second accepts only
values that have previously been passed to the first contract.
If weak? is not #f, the first contract holds onto
the values only weakly. from and to are the names
of the of the two contracts.