28.02.2014 Views

Burke_et_al-NIL_Reference_Manual_0286-1984

Burke_et_al-NIL_Reference_Manual_0286-1984

Burke_et_al-NIL_Reference_Manual_0286-1984

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Iteration Constructs 34 <strong>NIL</strong> Manu<strong>al</strong><br />

See "Iso the loop macro, page 144. loop is a "programmahle iteration facility". which <strong>al</strong>lows<br />

one to combine various sorts of iterations (such as those provided by dotimes and dovector) with<br />

vilrious sorts of result accumuhttion (such as those provided by mapcar. mapcan. every. some.<br />

and other things such as summing and counting). Because it is complicated. it is documented<br />

fully in Ch4tptcr 17. page 144. An earlier version of that chapter appeared as [51. which is<br />

expected to be re.vised· similarly.<br />

5.6.3 Block and Tagbody<br />

block Clnd tagbody tog<strong>et</strong>her implement the flow-of-control function<strong>al</strong>ity pf()\'idcd hy standard<br />

prog. prog could have been implcmcnted as a milCro in terms uf these and l<strong>et</strong>. and in fil<strong>et</strong> is<br />

descrihed in that filshion by COMMON LISP.<br />

block nome {declar<strong>al</strong>ion}- ljorm}*<br />

block· ev<strong>al</strong>uates the jiJrms. If a lcxicaJly apparent r<strong>et</strong>urn-from is ev<strong>al</strong>uated with a tag of<br />

lIome (or l1ame is nil arid a r<strong>et</strong>urn is ev<strong>al</strong>uated). then the vaJue(s) of the form given to<br />

r<strong>et</strong>urn or r<strong>et</strong>urn-from arc r<strong>et</strong>urned as the \"<strong>al</strong>ue of the block form. Otherwise'. the block<br />

filrm r<strong>et</strong>urns the v<strong>al</strong>uc(s)uf the ev<strong>al</strong>umion of the lClst fonll.<br />

Note that the argument to r<strong>et</strong>urn or r<strong>et</strong>urn-from is ev<strong>al</strong>uated in the environment in<br />

which it occurs, 1101 the environment where the block was established.<br />

r<strong>et</strong>urn fonn<br />

Ev<strong>al</strong>uates jbnl1 , and r<strong>et</strong>urns the v<strong>al</strong>ue(s) it r<strong>et</strong>urns from the nearest lexic.llly apparent<br />

block with a name of nil. Many speci<strong>al</strong> forms implicitly establish blocks named nil. such<br />

as prog. do. do list. dotimes, dovector, and (usu<strong>al</strong>ly) loop.<br />

Note that this differs subtly from LISP MACIIINFl.JSP. In LlSI' MA(,IU~F. I.JSP. r<strong>et</strong>urn<br />

r<strong>et</strong>urns from the innermost prog (Le.. block) which is 1101 named t. In <strong>NIL</strong> (and COMMON<br />

LISP), a r<strong>et</strong>urn to a block name of nil only matches a block name of nil, and the block<br />

name t is not distinguished in any way.<br />

r<strong>et</strong>urn-from name form<br />

Ev<strong>al</strong>uates fonn, and r<strong>et</strong>urns the v<strong>al</strong>ue(s) it r<strong>et</strong>urns from the nearest lexic<strong>al</strong>ly apparent<br />

block with a name of name. name is not ev<strong>al</strong>uated.<br />

tagbody {tag J form}-<br />

The body of a tagbody is examined sequenti<strong>al</strong>ly. If a fonn is atomic. then it is a tag and<br />

is ignored, otherwise it is ev<strong>al</strong>uated. If during the ev<strong>al</strong>uation a lexica11y apparent c<strong>al</strong>l to<br />

go is ev<strong>al</strong>uated with an argument of one of the tags. then control is r<strong>et</strong>urned to that<br />

point within the tagbody fonn. which resumes its interpr<strong>et</strong>ation. If the interpr<strong>et</strong>ation<br />

reaches the end of the tagbody. the result is nit<br />

MC:NII.MAN:PCONS81<br />

23-DEC-83

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

Saved successfully!

Ooh no, something went wrong!