(index ("bind" 0) ("bindings" 2582) ("seq-db" 2755) ("seq-db" 2836) ("bind" 3155) ("bindable?" 3380) ("bind-case" 3655) ("bind-define" 3881) ("bind-set!" 4089) ("bind-lambda" 4266) ("bind-lambda*" 4414) ("bind-case-lambda" 4570) ("bind-case-lambda*" 4744) ("bind-named" 4926) ("bindrec" 5120) ("bind-let" 5276) ("bind-let*" 5549) ("bind-letrec" 5704) ("bind/cc" 5865) ("define-algebraic-type" 6008))
(def (sig (syntax "(bind pat seq (where fender ...) .. xpr ....)" (id bind))) (p "Here, a pattern, pat, is a nested psudolist of (mostly) symbols, seq a sequencce expression, i.e. a mixture of pseudolists, vectors and strings, fender a check expression on pattern variables, var, of the form (var ok? ...) and xpr ....  constitute the body of the macro. Note the special use of dots here and below: Three dots repeat the expression to the left zero or many times, two dots zero or one times and four dots one or many times.") (p "This macro binds pattern variables, i.e. symbols of pat, to corresponding sequenceds of seq, checks, if the fenders succeed and exectutes the body in this context.") (p "There are some features, which I would like to have and which are implemented as well. First wildcards, represented by the underscore symbol. It matches everything, but binds nothing. So it can appear multiple times in the same macro. Wildcard symbols are simply not collected in the internal destructure routine.") (p "Second, non-symbol literals, which don't bind anything, of course, but match only expressions evaluating to themselves.") (p "The last feature missing is fenders, which is important in particular for bind-case and can easily be implemented with a where clause: A pattern matches successfully if only each pattern variable can be bound and the checks as well as the fenders are satisfied. If the where clause doesn't pass, the next pattern is tried in bind-case or a seq-exception is signalled in bind.") (p "This version of the library is a complete rewrite. The code no longer uses Graham's dbind implementation. Instead, a direct implementation of bind is given, which doesn't need gensyms. The internal destructure routine transforms the pattern and sequence arguments into three lists, pairs, literals and tails. Pairs is a list of pattern-variable and corresponding sequence-accesscode pairs to be used in a let at runtime, literals and tails check for equality of literals and their corresponding sequence values, and the emptyness of sequence tails corresponding to null patterns respectively. So, contrary to Graham's dbind, an exception is raised if the lengths of a pattern and its corresponding sequence don't match. Fenders are supplied in a where clause at the very beginning of the macro body: A list of pattern-variable predicates pairs is internally transformed into a list of predicate calls.") (p "The latest addition to the library are algebraic types, to be accessed via the binding macros, thus making e.g. define-concrete-type obsolete."))
(def (sig (procedure "(bindings sym ..)" (id bindings))) (p "documentation procedure. Shows the exported symbols and the syntax of such an exported symbol, respectively."))
(def (sig (procedure "(seq-db)" (id seq-db))) (p "shows the sequence database"))
(def (sig (procedure "(seq-db type? ref: ref tail: tail maker: maker ra?: random-access?)" (id seq-db))) (p "adds a new custom sequence type with predicate type? and keyword arguments ref: tail: maker: ra?: naming procedures to be later accessed as seq-ref, seq-tail, seq-maker and seq-randoam-access? respectively."))
(def (sig (syntax "(bind pat seq (where fender ...) .. xpr ....)" (id bind))) (p "binds pattern variables of pat to subexpressions of seq and executes xpr .... in this context, provided all fenders return #t, if supplied."))
(def (sig (syntax "(bindable? pat (where fender ...) ..)" (id bindable?))) (p "returns a unary predicate which checks, if its sequence argument matches the pattern argument, pat, of bindable? and passes all of its fenders (the syntax is slightly changed for consistency)."))
(def (sig (syntax "(bind-case seq (pat (where fender ...) .. xpr ....) ....)" (id bind-case))) (p "Matches seq against a series of patterns and executes the body of the first matching pattern satisfying fenders (if given)."))
(def (sig (syntax "(bind-define pat seq pat1 seq1 ... (where fender ...) ..)" (id bind-define))) (p "defines pattern variables of pat pat1 ... with values matching subexpressions of seq seq1 ... in one go"))
(def (sig (syntax "(bind-set! pat seq pat1 seq1 ... (where fender ...) ..)" (id bind-set!))) (p "sets symbols of pat pat1 ... to corresponding subexpressions of seq seq1 ..."))
(def (sig (syntax "(bind-lambda pat (where fender ...) .. xpr ....)" (id bind-lambda))) (p "combination of lambda and bind, one pattern argument"))
(def (sig (syntax "(bind-lambda* pat (where fender ...) .. xpr ....)" (id bind-lambda*))) (p "combination of lambda and bind, multiple pattern arguments"))
(def (sig (syntax "(bind-case-lambda (pat (where fender ...) .. xpr ....) ....)" (id bind-case-lambda))) (p "Combination of bind-case and lambda with one pattern argument"))
(def (sig (syntax "(bind-case-lambda* (pat (where fender ...) .. xpr ....) ....)" (id bind-case-lambda*))) (p "Combination of bind-case and lambda with multiple pattern arguments"))
(def (sig (syntax "(bind-named loop pat seq (where fender ...) .. xpr ....)" (id bind-named))) (p "named version of bind. loop is bound to a procedure, which can be used in the body xpr ...."))
(def (sig (syntax "(bindrec pat seq (where fender ...) .. xpr ....)" (id bindrec))) (p "bind pattern variables of pat to subsequences of seq recursively"))
(def (sig (syntax "(bind-let loop .. ((pat seq) ...) (where fender ...) .. xpr ....)" (id bind-let))) (p "like let, named and unnamed, but binds patterns to sequence templates. In the named case loop is bound to a one-parameter-procedure accessible in the body xpr ...."))
(def (sig (syntax "(bind-let* ((pat seq) ...) (where fender ...) .. xpr ....)" (id bind-let*))) (p "like let*, but binds patterns to sequence templates"))
(def (sig (syntax "(bind-letrec ((patseq) ...)  (where fender ...) .. xpr ....)" (id bind-letrec))) (p "like letrec, but binds patterns to sequence templates"))
(def (sig (syntax "(bind/cc cc xpr ....)" (id bind/cc))) (p "captures the current continuation in cc and executes xpr .... in this context."))
(def (sig (syntax "(define-algebraic-type NAME Name? Constructors ....)" (id define-algebraic-type))) (p "where each Constructor, Name, is one of") (pre " (Name (arg arg? ...) ...)\n (Name (arg arg? ...) ... args args?  ...)") (p "The generated type, NAME, can be destructured with bind, bind-case etc. as tagged vectors with #:Name as tag."))
