58 lines
3.7 KiB
HTML
58 lines
3.7 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>B.1. Introduction</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" Introduction">
|
||
|
<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=tex2html6238 HREF="node364.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html6236 HREF="node362.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html6230 HREF="node362.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html6240 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html6241 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html6239 HREF="node364.html"> Generators</A>
|
||
|
<B>Up:</B> <A NAME=tex2html6237 HREF="node362.html"> Generators and Gatherers</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html6231 HREF="node362.html"> Generators and Gatherers</A>
|
||
|
<HR> <P>
|
||
|
<H1><A NAME=SECTION003510000000000000000>B.1. Introduction</A></H1>
|
||
|
<P>
|
||
|
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
|
||
|
Generators are generalized input streams in the sense of
|
||
|
Smalltalk [<A HREF="node368.html#SMALLTALK80BOOK">20</A>]. A generator can produce a potentially
|
||
|
unbounded number of elements of any type. Individual elements are not
|
||
|
computed until requested by <tt>next-in</tt>. When an element is taken from
|
||
|
a generator, it is removed by side effect. Subsequent uses of
|
||
|
<tt>next-in</tt> obtain later elements.
|
||
|
<P>
|
||
|
There is a close relationship between a generator and a series of the
|
||
|
elements it produces. In particular, any series can be converted into
|
||
|
a generator. As a result, all the scanner functions used for
|
||
|
creating series (see appendix <A HREF="node347.html#SERIES">A</A>) can be used to create
|
||
|
generators as well. There is no need to have a separate
|
||
|
set of functions for creating generators.
|
||
|
<P>
|
||
|
Gatherers are generalized output streams. Elements of any type can be
|
||
|
entered into a gatherer using <tt>next-out</tt>. The gatherer combines the
|
||
|
elements together in time-sequence order into a net result. This result can
|
||
|
be retrieved using <tt>result-of</tt>.
|
||
|
<P>
|
||
|
There is a close relationship between a gatherer and a collector function
|
||
|
that combines elements in the same way. In particular, any one-input
|
||
|
one-output collector can be converted into a gatherer. As a result, all
|
||
|
the collectors used for computing summary results from series can be used to
|
||
|
create gatherers. There is no need to have a separate set of functions for
|
||
|
creating gatherers.
|
||
|
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
|
||
|
<P>
|
||
|
<BR> <HR><A NAME=tex2html6238 HREF="node364.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html6236 HREF="node362.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html6230 HREF="node362.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html6240 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html6241 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
|
||
|
<B> Next:</B> <A NAME=tex2html6239 HREF="node364.html"> Generators</A>
|
||
|
<B>Up:</B> <A NAME=tex2html6237 HREF="node362.html"> Generators and Gatherers</A>
|
||
|
<B> Previous:</B> <A NAME=tex2html6231 HREF="node362.html"> Generators and Gatherers</A>
|
||
|
<HR> <P>
|
||
|
<HR>
|
||
|
<P><ADDRESS>
|
||
|
AI.Repository@cs.cmu.edu
|
||
|
</ADDRESS>
|
||
|
</BODY>
|