On this page:
7.1 Flat Contracts
nat/ c
pos/ c
truth/ c
7.2 Higher-Order Contracts
thunk/ c
unary/ c
binary/ c
predicate/ c
predicate-like/ c
comparison/ c
comparison-like/ c

7 Contracts

 (require (planet cce/scheme:5:0/contract))

This module provides useful contracts and contract constructors.

7.1 Flat Contracts

This contract recognizes natural numbers that satisfy exact-nonnegative-integer?.

This contract recognizes positive integers that satisfy exact-positive-integer?.

This contract recognizes Scheme 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.

7.2 Higher-Order Contracts

These contracts recognize functions that accept 0, 1, or 2 arguments, respectively, and produce a single result.

These contracts recognize predicates: functions of a single argument that produce a boolean result.

The first constrains its output to satisfy boolean?. Use predicate/c in positive position for predicates that guarantee a result of #t or #f.

The second constrains its output to satisfy truth/c. Use predicate-like/c in negative position for predicates passed as arguments that may return arbitrary values as truth values.

These contracts recognize comparisons: functions of two arguments that produce a boolean result.

The first constrains its output to satisfy boolean?. Use comparison/c in positive position for comparisons that guarantee a result of #t or #f.

The second constrains its output to satisfy truth/c. Use comparison-like/c in negative position for comparisons passed as arguments that may return arbitrary values as truth values.