This library is unstable;
compatibility will not be maintained.
See Unstable: May Change Without Warning
for more information.
Returns #t if x is a string and is not empty;
returns #f otherwise.
The subsequent bindings were added by Ryan Culpepper.
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
For example, the following contract enforces that if a value is a
procedure, it is a thunk; otherwise it can be any (non-procedure)
Note that the following contract is not equivalent:
The last contract is the same as any/c
tries flat contracts before higher-order contracts.
A contract that describes the failure result arguments of procedures
such as hash-ref
Equivalent to (if/c procedure? (-> any) any/c).
Produces a contract that acts like contract but with the name
The resulting contract is a flat contract if contract is a
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 <firstname.lastname@example.org>.
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.
Wraps a sequence
obligating it to produce as many values as there are elem/c
and obligating each value to satisfy the corresponding elem/c
result is not guaranteed to be the same kind of sequence as the original value;
for instance, a wrapped list is not guaranteed to satisfy list?
If min-count is a number, the stream is required to have at least that many elements in it.
|> (for ([P predicates])|
| (printf "~s\n" (P "cat")))|
predicates: broke its contract
in: the range of
an element of
(sequence/c (-> any/c boolean?))
contract from: (definition predicates)
blaming: (definition predicates)
|> (for ([(N S) numbers&strings])|
| (printf "~s: ~a\n" N S))|
numbers&strings: broke its contract
in: an element of
(sequence/c number? string?)
contract from: (definition numbers&strings)
blaming: (definition numbers&strings)
0 is x
a-sequence: broke its contract
promised: a sequence that contains at least 2 values
in: (sequence/c #:min-count 2 char?)
contract from: (definition a-sequence)
blaming: (definition a-sequence)
The subsequent bindings were added by Neil Toronto <email@example.com>.
Identifies values that meet the contract elem-contract, lists of such values, lists of lists, and so on.