On this page:
maybe/  c
truth/  c

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

Equivalent to (or/c path-string? (symbols 'up 'same)).

The subsequent bindings were added by Asumu Takikawa.


(maybe/c contract)  contract?

  contract : contract?
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 <[email protected]>.

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 <[email protected]>.


(treeof elem-contract)  contract?

  elem-contract : contract?
Identifies values that meet the contract elem-contract, lists of such values, lists of lists, and so on.

> (define number-tree/c (treeof number?))
> (flat-contract? number-tree/c)


> (define number-tree? (flat-contract-predicate number-tree/c))
> (number-tree? 4)


> (number-tree? '(4 5))


> (number-tree? '((4 5) 6))


> (number-tree? '(4 . 5))