with-gensymsGBBopen Toolsxorwith-once-only-bindingsGoTo Top

with-once-only-bindings   (symbol*) declaration* form* => result*[Macro]

Evaluate, in order, each symbol and then make every reference to symbol inside each form refer to that value.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

symbols     Zero or more symbols to be evaluated once only
declaration     A declare expression (not evaluated)
forms     An implicit progn of forms to be evaluated
results     The values returned by evaluating the last form

The values returned by evaluating the last form.

This is GBBopen's version of the “once-only” macro-writing macro that ensures that the forms associated with macro arguments are only evaluated once and in the specified order.


  (define-compiler-macro ensure-list (x)
    (with-once-only-bindings (x)
      `(if (listp ,x) ,x (list ,x))))

The GBBopen Project

with-gensymsGBBopen Toolsxorwith-once-only-bindingsGoTo Top