This library is unstable; compatibility will not be maintained. See Unstable for more information.
Contract for non-empty strings.
Equivalent to (between/c 1 65535).
The subsequent bindings were added by Ryan Culpepper.
|(if/c predicate then-contract else-contract) → contract?|
|predicate : (-> any/c any/c)|
|then-contract : contract?|
|else-contract : contract?|
Produces a contract that, when applied to a value, first tests the value with predicate; if predicate returns true, the then-contract is applied; otherwise, the else-contract is applied. The resulting contract is a flat contract if both then-contract and else-contract are flat contracts.
For example, the following contract enforces that if a value is a procedure, it is a thunk; otherwise it can be any (non-procedure) value:
Note that the following contract is not equivalent:
The last contract is the same as any/c because or/c tries flat contracts before higher-order contracts.
Produces a contract that acts like contract but with the name name.
The resulting contract is a flat contract if contract is a flat contract.