All Manuals > LispWorks® User Guide and Reference Manual > 38 The LISPWORKS Package

rebinding Macro

Summary

Ensures unique names for all the variables in a groups of forms.

Package

lispworks

Signature

rebinding (&rest vars) &body body => form

Arguments
vars
The variables to be rebound.
body
A body of forms, the variables in which should be unique.
Values
form
A form.
Description

The macro rebinding returns body wrapped in a form which creates a unique name for each variables in vars (compare with gensym) and binds these names to the values of the variables. This ensures that the body can refer to the variables without name clashes with other variables elsewhere.

Examples

After defining:

(defmacro lister (x y)
   (rebinding (x y)
      '(list ,x ,y)))

the form (lister i j) macroexpands to:

(LET* ((#:X-77 I)
       (#:Y-78 J))
          (LIST #:X-77 #:Y-78))
See also

with-unique-names


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:41