7.7
3 Contracts
NOTE: This library is deprecated; use racket/contract , instead. The contents of this module, with the exceptions below, have been merged with racket/contract.
(require unstable/contract) | |
package: unstable-contract-lib |
value
The subsequent bindings were added by Asumu Takikawa.
Creates a contract that acts like contract but will also
accept #f. Intended to describe situations where a failure
or default value may be used.
The subsequent bindings were added by Carl Eastlund <cce@racket-lang.org>.
value
This contract recognizes Racket truth values, i.e., any value, but with a more
informative name and description. Use it in negative positions for arguments
that accept arbitrary truth values that may not be booleans.
The subsequent bindings were added by Neil Toronto <neil.toronto@gmail.com>.
Identifies values that meet the contract elem-contract, lists of such values, lists of lists, and so on.
Examples:
> (define number-tree/c (treeof number?)) > (flat-contract? number-tree/c) #t
> (define number-tree? (flat-contract-predicate number-tree/c)) > (number-tree? 4) #t
> (number-tree? '(4 5)) #t
> (number-tree? '((4 5) 6)) #t
> (number-tree? '(4 . 5)) #f