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.

let* 290<br />

I<br />

vforms. Thus the bindings happen in parallel; all the vforms are evaluated<br />

before any of the vars are bound. Finally, the bforms (the body) are<br />

evaluated sequentially, the old values of the variables are restored, and the<br />

result of the last bform is returned.<br />

You can omit the vform from a let clause, in which case it is as if the<br />

vform were nil: the variable is bound to nil. Furthermore, you can replace<br />

the entire clause (the list of the variable and form) with just the variable,<br />

which also means that the variable gets bound to nil. I t is customary to<br />

write just a variable, rather than a clause, to indicate that the value to<br />

which the variable is bound does not matter, because the variable is<br />

setq'ed before its first use. Example:<br />

(let «a (+ 3 3»<br />

(b 'foo)<br />

(c)<br />

d)<br />

... )<br />

Within the body, a is bound to 6, b is bound to foo, c is bound to nil, and<br />

d is bound to nil.<br />

See the section "Special Forms for Binding Variables" in Symbolics Common<br />

Lisp: Language Concepts.<br />

let* ((var value) ... ) body... Special Form<br />

The same as let, except that the binding is sequential. Each var is bound<br />

to the value of its vform before the next vform is evaluated. This is useful<br />

when the computation of a vform depends on the value of a variable bound<br />

in an earlier vform. Example:<br />

(let* «a (+ 1 2»<br />

(b (+ a a»)<br />

... )<br />

Within the body, a is bound to 3 and b is bound to 6.<br />

See the section "Special Forms for Binding Variables" in Symbolics Common<br />

Lisp: Language Concepts.<br />

let-and-make-dynamic-closure vars &body body Function<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".<br />

let-and-make-dynamic-closure is a special form that does all of this. It is<br />

best described by example:

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

Saved successfully!

Ooh no, something went wrong!