doc.txt

Contract-utils

_Contract-utils_
_contract-utils_

Richard Cobbe
<cobbe at ccs dot neu dot edu>

This collection provides one file, _contract-utils.ss_, which implements
several genera-purpose contracts and contract utilities.

======================================================================

> (nelistof/c flat-contract) 

This function accepts a flat contract (or a predicate, which is converted
to a flat contract) and produces a contract that recognizes non-empty lists
whose elements match the given contract.

> sexp/c

This flat contract recognizes arbitrary S-expressions.  Here, an
S-expression is either the empty list, a number, a symbol, a string, a
Boolean, a character, or a cons cell containing two S-expressions.

> predicate/c

This flat contract recognizes (unary) predicate functions.  A predicate
function is a function which can consume any single value and always
produces a Boolean result.

> (optional/c flat-contract)

This function accepts a flat contract (or a predicate) and produces a
contract that recognizes an optional value---that is, either a value that
satisfies the given contract, or #f.

> positive-int/c

This flat contract recognizes strictly positive integers.

> (eta function)

This macro simply eta-expands function; that is, it expands to 
    (lambda args (apply f args)) .
This is useful primarily to allow contract definitions to appear before
their predicate definitions, for legibility reasons.

======================================================================

Contract-Utils: general-purpose PLT contract utilities.
Copyright (C) 2005  Richard Cobbe

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
License for more details.

You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA