Version: 4.2.4
12 Anaphoric Contracts
(require unstable/poly-c) |
This library is unstable;
compatibility will not be maintained.
See Unstable for more information.
(poly/c ([id+ id-] ...) cnt) |
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) | ||
| ||
|
(apply/c cnt [#:name name]) → contract? |
cnt : any/c |
name : any/c = (build-compound-type-name 'apply/c c) |
Produces a procedure contract that is like cnt, but any delayed
evalutation in cnt is re-done on every
application of the contracted function.
| |||||||||||||||||||||||||||||||||||||||||||||
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.