chickadee » bindings » bind

(bind pat seq xpr . xprs)syntax
(bind! pat seq)syntax

Here, a pattern, pat, is either

  • a symbol,
  • a literal (char, string, keyword, boolean or number)
  • a dotted list
  • a pair of patterns.

where dotted lists (i.e nested list patterns followed by two, tree or four dots) are new since version 4.0, and seq is a nested sequence expression, i.e. a mixture of pseudolists, vectors and strings. Other sequence types can be added by means of sequence-db, which is reexported from simple-sequences.

Patterns are used to control the destructuring of sequences, bind pattern variables to corresponding subexpressions of seq, controlling their length and checking if literals match themselfs. Then either the body is executed in this context, or the pattern variables are set! to the values of the corresponding subexpression. Since the wildcard binds nothing, it can appear multiple times in the same macro.