You are looking at historical revision 23330 of this page. It may differ significantly from its current revision.
The bindings module is a light-weight alternative to the matchable egg together with some enhancements, in particular the bind macro, which is Common Lisp's destructuring-bind.
Contrary to matchable, there is no attempt to implement ellipses, Scheme's dotted lists must do. Instead of the match macro you should use bind-case.
In this implementation bindings are implemented in the Design by Contract style, i.e. using the contracts module. A corollary of this is, that the documentation is included in the module. By convention, there is a routine with the module's name, bindings, which when called with no argument
shows the exported symbols, namely
Choose one of: -------------- bind bind-case bind-case-lambda bind-case-lambda* bind-define bind-flat bind-flat-let* bind-lambda bind-lambda* bind-let bind-let* bind-letrec bind-loop bind-matches? bind-set! bindrec
which are all macros, while calling bindings with one of this symbols, e.g.
shows the documentation of this symbol in all it's glory, i.e. together with admissible forms and documentation
(forms: (bind pat xpr0 xpr . xprs)) "binds pattern variables of pat to subexpressions of xpr0 and executes xpr ..."
will show you
(forms: (bind-case xpr0 (pat (=> test?) xpr . xprs) (bind-case xpr0 (pat xpr . xprs)) (bind-case xpr0 (pat (=> test?) xpr . xprs) clause ...) (bind-case xpr0 (pat xpr . xprs) clause ...)) "matches xpr0 against a series of patterns [with fender test?, a thunk] and executes the body of the first matching pattern [satisfying test?]"
Another way to get the complete documentation is to use print-doclist from the contracts module. Issuing
(import bindings (only contracts print-doclist)) (with-output-to-file "bindings.docu" (lambda () (print-doclist)))
you'll get the complete documentation written to the file bindings.docu.
Copyright (c) 2011, Juergen Lorenz All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- initial import