17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

291<br />

<strong>zl</strong>:let-closed<br />

I<br />

(let-and-make-dynamic-c1osure «a 5) b (c 'x»<br />

(function (lambda () ... »)<br />

macro-expands into<br />

(let «a 5) b (c 'x»<br />

(declare (special abc »<br />

(make-dynamic-c1osure 'ea b c)<br />

(funct ion (1 ambda 0 ... »»)<br />

See the section "Dynamic Closure-Manipulating Functions" in Symbolics<br />

Common Lisp: Language Concepts.<br />

<strong>zl</strong>:let-closed ((variable value) ... ) function Special Form<br />

When using dynamic closures, it is very common to bind a set of variables<br />

with initial values, and then make a closure over those variables. Furthermore,<br />

the variables must be declared as "special". <strong>zl</strong>:let-closed is a special<br />

form that does all of this. It is best described by example:<br />

(let-closed «a 5) b (c 'x»<br />

(funct ion (1 ambda 0 ... »)<br />

macro-expands into<br />

(let «a 5) b (c 'x»<br />

(declare (special abc »<br />

(closure 'ea b c)<br />

(functi on (1 ambda 0 ... »»)<br />

The Symbolics Common Lisp equivalent of this function is<br />

let-and-make-dynamic-closure. See the section "Dynamic Closure­<br />

Manipulating Functions" in Symbolics Common Lisp: Language Concepts.<br />

letf places-and-values body...<br />

Special Form<br />

Just like let, except that it can bind any storage cells rather than just variables.<br />

The cell to be bound is specified by an access form that must be acceptable<br />

to locf. For example, letf can be used to bind slots in a structure.<br />

letf does parallel binding.<br />

Given the following structure, letf calls do-something-to with ship's x<br />

position bound to zero.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!