64 lines
3.8 KiB
HTML
64 lines
3.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>7.8.1. Indefinite Iteration</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value=" Indefinite Iteration">
|
|
<meta name="keywords" value="clm">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<b>Common Lisp the Language, 2nd Edition</b>
|
|
<BR> <HR><A NAME=tex2html2613 HREF="node88.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2611 HREF="node86.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2605 HREF="node86.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2615 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2616 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2614 HREF="node88.html"> General Iteration</A>
|
|
<B>Up:</B> <A NAME=tex2html2612 HREF="node86.html"> Iteration</A>
|
|
<B> Previous:</B> <A NAME=tex2html2606 HREF="node86.html"> Iteration</A>
|
|
<HR> <P>
|
|
<H2><A NAME=SECTION001181000000000000000>7.8.1. Indefinite Iteration</A></H2>
|
|
<P>
|
|
The <tt>loop</tt> construct is the simplest iteration facility.
|
|
It controls no variables, and simply executes its body repeatedly.
|
|
<P>
|
|
<BR><b>[Macro]</b><BR>
|
|
<tt>loop</tt> <tt>{<i>form</i>}*</tt><P>Each <i>form</i> is evaluated in turn from left to right.
|
|
When the last <i>form</i> has been evaluated, then the first <i>form</i>
|
|
is evaluated again, and so on, in a never-ending cycle.
|
|
The <tt>loop</tt> construct never returns a value. Its execution must be terminated
|
|
explicitly, using <tt>return</tt> or <tt>throw</tt>, for example.
|
|
<P>
|
|
<tt>loop</tt>, like most iteration constructs,
|
|
establishes an implicit block named <tt>nil</tt>.
|
|
Thus <tt>return</tt> may be used to exit from a <tt>loop</tt> with specified results.
|
|
<P>
|
|
<img align=bottom alt="old_change_begin" src="gif/old_change_begin.gif"><br>
|
|
A <tt>loop</tt> construct has this meaning only if every <i>form</i> is
|
|
non-atomic (a list). The case where some <i>form</i> is
|
|
atomic is reserved for future extensions.
|
|
<P>
|
|
<hr>
|
|
<b>Implementation note:</b>
|
|
There have been several proposals for a powerful iteration
|
|
mechanism to be called <tt>loop</tt>. One version is provided in Lisp Machine Lisp.
|
|
Implementors are encouraged to experiment with extensions to the <tt>loop</tt>
|
|
syntax, but users should be advised that in all likelihood some specific
|
|
set of extensions to <tt>loop</tt> will be adopted in a future revision of Common Lisp.
|
|
<hr>
|
|
<br><img align=bottom alt="old_change_end" src="gif/old_change_end.gif">
|
|
<P>
|
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
|
X3J13 voted in January 1989
|
|
(LOOP-FACILITY) <A NAME=7041> </A>
|
|
to include just such an extension of <tt>loop</tt>. See chapter <A HREF="node235.html#LOOP">26</A>.
|
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html2613 HREF="node88.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html2611 HREF="node86.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html2605 HREF="node86.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html2615 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html2616 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2614 HREF="node88.html"> General Iteration</A>
|
|
<B>Up:</B> <A NAME=tex2html2612 HREF="node86.html"> Iteration</A>
|
|
<B> Previous:</B> <A NAME=tex2html2606 HREF="node86.html"> Iteration</A>
|
|
<HR> <P>
|
|
<HR>
|
|
<P><ADDRESS>
|
|
AI.Repository@cs.cmu.edu
|
|
</ADDRESS>
|
|
</BODY>
|