metabang-bind

API Reference

metabang-bind

Bind is a macro that generalizes multiple-value-bind, let, let*, destructuring-bind, structure and slot accessors, and a whole lot more.

METABANG.BIND

  • Function BINDING-FORM-DOCSTRING (name)
    Returns the docstring for a binding form named `name`.
  • Function (setf BINDING-FORM-DOCSTRING) (docstring name/s)
  • Macro LAMBDA-BIND ((&rest instrs) &rest body)
    Use `bind' to allow restructuring of argument to lambda expressions. This lets you funcall and destructure simultaneously. For example (let ((fn (lambda-bind ((a b) c) (cons a c)))) (funcall fn '(1 2) 3)) ;; => (1 . 3) Via eschulte (see git://gist.github.com/902174.git).
  • Variable *UNUSED-DECLARATIONS-BEHAVIOR*
    :print-warning
    Tells bind how to behave when it encounters an unused declaration. The possible options are * :print-warning (the current default) - print a warning about the problem and signal a `bind-unused-declarations-condition` * :warn - signal a `bind-unused-declarations-warning` warning * :error - signal a `bind-unused-declarations-error` error
  • Variable *BIND-ALL-DECLARATIONS*
    '(dynamic-extent ignore optimize ftype inline special ignorable notinline type)
  • Variable *BIND-NON-VAR-DECLARATIONS*
    '(optimize ftype inline notinline)
  • Variable *BIND-LAMBDA-LIST-MARKERS*
    '(&key &body &rest metabang.bind::&args &optional)
  • Condition BIND-MISSING-VALUE-FORM-WARNING  (SIMPLE-STYLE-WARNING)
  • Condition BIND-TOO-MANY-VALUE-FORMS-ERROR  (ERROR)
  • Condition BIND-ERROR  (ERROR)
  • Condition BIND-KEYWORD/OPTIONAL-NIL-WITH-DEFAULT-ERROR  (BIND-ERROR)
  • Condition BIND-UNUSED-DECLARATIONS-CONDITION
  • Condition BIND-UNUSED-DECLARATIONS-WARNING  (BIND-UNUSED-DECLARATIONS-CONDITION, SIMPLE-STYLE-WARNING)
  • Condition BIND-UNUSED-DECLARATIONS-ERROR  (BIND-UNUSED-DECLARATIONS-CONDITION, ERROR)
  • Function BINDING-FORMS
    Return a list of all binding-forms that bind supports in alphabetical order.
  • Function BINDING-FORM-GROUPS
    Return a list of the available binding-forms grouped into their synonyms.
  • Function BINDING-FORM-SYNONYMS (name)
    Return a list of synonyms for the binding-form `name`. For example > (binding-form-synonyms :accessors) (:accessors :writable-accessors)
  • Macro BIND ((&rest bindings) &body body)
    Bind is a replacement for let*, destructuring-bind, multiple-value-bind and more. An example is probably the best way to describe its syntax: (bind ((a 2) ((b &rest args &key (c 2) &allow-other-keys) '(:a :c 5 :d 10 :e 54)) ((:values d e) (truncate 4.5)) ((:structure xxx- slot1 slot2) (make-xxx)) ((:flet name (arg1 arg2)) (+ arg1 arg2))) (list a b c d e args)) Simple bindings are as in let*. Destructuring is done if the first item in a binding is a list. Multiple value binding is done if the first item in a binding is a list and the first item in the list is ':values'. Other forms have their own syntax. For example, :structure first has the conc name and then slot names whereas :flet has the function name and a list of arguments and then the function body (in an implicit progn).
  • Macro FLUID-BIND ((&rest bindings) &body body)
    Fluid-bind is an extension of bind that handles setting and resetting places. For example, suppose that an object of class foo has a slot named bar whose value is currently 3. The following code would evaluate the inner body with bar bound to 17 and restore it when the inner body is exited. (fluid-bind (((bar foo) 17)) (print (bar foo))) (print (bar foo)) ==> (prints 17, then 3) This is similar to dynamic-binding but _much_ less robust.

METABANG.BIND.DEVELOPER

No exported symbols.

Also exports

  • METABANG.BIND:BIND-MACRO-HELPER
  • METABANG.BIND:BIND-FIX-NILS
  • METABANG.BIND:BIND-GENERATE-BINDINGS
  • METABANG.BIND:BIND-FILTER-DECLARATIONS