Improve srfi-std html files.
Re-encode in UTF-8, and for the main page also improve the text with some racket-isms. (Could use much more work, of course.)
This commit is contained in:
parent
2abcb883cd
commit
3175ab2ce6
|
@ -1,11 +1,11 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>SRFI documents inside PLT</title>
|
||||
<title>SRFI documents inside Racket</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>SRFI documents inside PLT</h1>
|
||||
<h1>SRFI documents inside Racket</h1>
|
||||
|
||||
<h1>Scheme Requests for Implementation</h1>
|
||||
|
||||
|
@ -16,176 +16,176 @@
|
|||
between implementations.</p>
|
||||
|
||||
<p>This manual includes the <em style="font-style: normal">original</em> documentation of all
|
||||
the SRFIs already ported to PLT Scheme. For more information on
|
||||
the SRFIs already ported to Racket. For more information on
|
||||
the SRFI process, please <a href="http://srfi.schemers.org">follow
|
||||
this link</a>.</p>
|
||||
|
||||
|
||||
<h2>Loading</h2>
|
||||
|
||||
<p>To load a SRFI with name conflicts (currently SRFIs 1, 5, 13, 17, 19, 43,
|
||||
<p>To load a SRFI with name conflicts (currently SRFIs 1, 5, 13, 17, 19, 43,
|
||||
45, 48, 61, 63, 69 and 87) in a module,<br>
|
||||
please see the note below.<br>
|
||||
<br>
|
||||
To load a SRFI, use the following form:<br>
|
||||
<br>
|
||||
(require (lib "N.ss" "srfi"))<br>
|
||||
(require srfi/N)<br>
|
||||
<br>
|
||||
if you know the number of the SRFI you want to load. This is the preferred
|
||||
method, or this one:<br>
|
||||
if you know the number of the SRFI you want to load. This is the preferred
|
||||
method. Alternatively, use this one:<br>
|
||||
<br>
|
||||
(require (lib "NAME.ss" "srfi" "N"))<br>
|
||||
(require srfi/N/NAME)<br>
|
||||
<br>
|
||||
if you know the `informative name' of the SRFI.<br>
|
||||
<br>
|
||||
N, is a number corresponding to the sub-collection that holds a particular
|
||||
SRFI, and NAME is a more descriptive name we assigned to the main file in
|
||||
which the SRFI is defined. For instance, to load SRFI-34 you have to do
|
||||
N, is a number corresponding to the sub-collection that holds a particular
|
||||
SRFI, and NAME is a more descriptive name we assigned to the main file in
|
||||
which the SRFI is defined. For instance, to load SRFI-34 you have to do
|
||||
either one of:<br>
|
||||
<br>
|
||||
(require (lib "34.ss" "srfi"))<br>
|
||||
(require srfi/34)<br>
|
||||
<br>
|
||||
or,<br>
|
||||
<br>
|
||||
(require (lib "exception.ss" "srfi" "34"))<br>
|
||||
(require srfi/34/exception)<br>
|
||||
<br>
|
||||
<EFBFBD><EFBFBD></p>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<b><font color="#FF0000">NOTE on SRFIs with name conflicts</font><br>
|
||||
</b><br>
|
||||
Certain SRFIs (currently SRFIs 1, 5, 13, 17, 19, 43, 45, 48, 61, 63, 69 and
|
||||
87) provide names which conflict with names provided by the 'mzscheme'
|
||||
language. Attempting to require one of these SRFIs in a module written in
|
||||
the 'mzscheme' language will result in an error.<br>
|
||||
Certain SRFIs (currently SRFIs 1, 5, 13, 17, 19, 43, 45, 48, 61, 63, 69 and
|
||||
87) provide names which conflict with names provided by the <tt>racket</tt>
|
||||
language. Attempting to require one of these SRFIs in a module written in
|
||||
the <tt>racket</tt> language will result in an error.<br>
|
||||
<br>
|
||||
To address this problem, the PLT implementations of these SRFIs provide a
|
||||
different module which renames the problematic exports to avoid these
|
||||
conflicts. For SRFI 1, this library is called list.ss, and should be
|
||||
To address this problem, the Racket implementations of these SRFIs provide a
|
||||
different module which renames the problematic exports to avoid these
|
||||
conflicts. For SRFI 1, this library is called list, and should be
|
||||
required like this:<br>
|
||||
<br>
|
||||
(require (lib "list.ss" "srfi" "1"))<br>
|
||||
(require srfi/1/list)<br>
|
||||
<br>
|
||||
which supplies the colliding names with a prefix of 's:' (e.g. "s:map",
|
||||
which supplies the colliding names with a prefix of 's:' (e.g. "s:map",
|
||||
"s:reverse!") and is therefore suitable for requires in a module.<br>
|
||||
<br>
|
||||
For SRFI 19, this library is called time.ss, and should be required like
|
||||
For SRFI 19, this library is called time, and should be required like
|
||||
this:<br>
|
||||
<br>
|
||||
(require (lib "time.ss" "srfi" "19"))<br>
|
||||
(require srfi/19/time)<br>
|
||||
<br>
|
||||
which supplies the colliding names with a prefix of 'srfi:' (e.g.
|
||||
which supplies the colliding names with a prefix of 'srfi:' (e.g.
|
||||
"srfi:date?", "srfi:date-second") and is therefore<br>
|
||||
suitable for requires in a module.<br>
|
||||
<br>
|
||||
<EFBFBD><EFBFBD></p>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<b>Supported SRFIs</b><br>
|
||||
<EFBFBD><EFBFBD></p>
|
||||
</p>
|
||||
|
||||
|
||||
<p>SRFI File
|
||||
name
|
||||
<p>SRFI File
|
||||
name
|
||||
Sub-collection<br>
|
||||
SRFI-1 list.ss
|
||||
SRFI-1 list.rkt
|
||||
1<br>
|
||||
SRFI-2 and-let.ss
|
||||
SRFI-2 and-let.rkt
|
||||
2<br>
|
||||
SRFI-4(*1) 4.ss<br>
|
||||
SRFI-5 let.ss
|
||||
SRFI-4(*1) 4.rkt<br>
|
||||
SRFI-5 let.rkt
|
||||
5<br>
|
||||
SRFI-6(+) 6.ss<br>
|
||||
SRFI-7 program.ss
|
||||
SRFI-6(+) 6.rkt<br>
|
||||
SRFI-7 program.rkt
|
||||
7<br>
|
||||
SRFI-8 receive.ss
|
||||
SRFI-8 receive.rkt
|
||||
8<br>
|
||||
SRFI-9 record.ss
|
||||
SRFI-9 record.rkt
|
||||
9<br>
|
||||
SRFI-11(+) 11.ss<br>
|
||||
SRFI-13 string.ss
|
||||
SRFI-11(+) 11.rkt<br>
|
||||
SRFI-13 string.rkt
|
||||
13<br>
|
||||
SRFI-14 char-set.ss
|
||||
SRFI-14 char-set.rkt
|
||||
14<br>
|
||||
SRFI-16(+) 16.ss<br>
|
||||
SRFI-17 set.ss
|
||||
SRFI-16(+) 16.rkt<br>
|
||||
SRFI-17 set.rkt
|
||||
17<br>
|
||||
SRFI-19(*2) time.ss
|
||||
SRFI-19(*2) time.rkt
|
||||
19<br>
|
||||
SRFI-23(+) 23.ss<br>
|
||||
SRFI-25 array.ss
|
||||
SRFI-23(+) 23.rkt<br>
|
||||
SRFI-25 array.rkt
|
||||
25<br>
|
||||
SRFI-26 cut.ss
|
||||
SRFI-26 cut.rkt
|
||||
26<br>
|
||||
SRFI-27 random-bits.ss
|
||||
SRFI-27 random-bits.rkt
|
||||
27<br>
|
||||
SRFI-28(+) 28.ss<br>
|
||||
SRFI-29 localization.ss
|
||||
SRFI-28(+) 28.rkt<br>
|
||||
SRFI-29 localization.rkt
|
||||
29<br>
|
||||
SRFI-30(+) 30.ss<br>
|
||||
SRFI-31 rec.ss
|
||||
SRFI-30(+) 30.rkt<br>
|
||||
SRFI-31 rec.rkt
|
||||
31<br>
|
||||
SRFI-32 sort.scm
|
||||
SRFI-32 sort.scm
|
||||
32<br>
|
||||
SRFI-34 exception.ss
|
||||
SRFI-34 exception.rkt
|
||||
34<br>
|
||||
SRFI-35 condition.ss
|
||||
SRFI-35 condition.rkt
|
||||
35<br>
|
||||
SRFI-38(+) 38.ss<br>
|
||||
SRFI-39(+) 39.ss<br>
|
||||
SRFI-40 stream.ss
|
||||
SRFI-38(+) 38.rkt<br>
|
||||
SRFI-39(+) 39.rkt<br>
|
||||
SRFI-40 stream.rkt
|
||||
40<br>
|
||||
SRFI-42 comprehensions.ss
|
||||
SRFI-42 comprehensions.rkt
|
||||
42<br>
|
||||
SRFI-43 vector-lib.ss
|
||||
SRFI-43 vector-lib.rkt
|
||||
43<br>
|
||||
SRFI-45(*3) lazy.ss
|
||||
SRFI-45(*3) lazy.rkt
|
||||
45<br>
|
||||
SRFI-48 format.ss
|
||||
SRFI-48 format.rkt
|
||||
48<br>
|
||||
SRFI-54 cat.ss
|
||||
SRFI-54 cat.rkt
|
||||
54<br>
|
||||
SRFI-57 records.ss
|
||||
SRFI-57 records.rkt
|
||||
57<br>
|
||||
SRFI-59 vicinity.ss
|
||||
SRFI-59 vicinity.rkt
|
||||
59<br>
|
||||
SRFI-60 60.ss
|
||||
SRFI-60 60.rkt
|
||||
60<br>
|
||||
SRFI-61 cond.ss
|
||||
SRFI-61 cond.rkt
|
||||
61<br>
|
||||
SRFI-62(+)<br>
|
||||
SRFI-63 63.ss
|
||||
SRFI-63 63.rkt
|
||||
63<br>
|
||||
SRFI-64 testing.ss
|
||||
SRFI-64 testing.rkt
|
||||
64<br>
|
||||
SRFI-66 66.ss
|
||||
SRFI-66 66.rkt
|
||||
66<br>
|
||||
SRFI-67 compare.ss
|
||||
SRFI-67 compare.rkt
|
||||
67<br>
|
||||
SRFI-69 hash.ss
|
||||
SRFI-69 hash.rkt
|
||||
69<br>
|
||||
SRFI-71 letvalues.ss
|
||||
SRFI-71 letvalues.rkt
|
||||
71<br>
|
||||
SRFI-74 74.ss
|
||||
SRFI-74 74.rkt
|
||||
74<br>
|
||||
SRFI-78 check.ss
|
||||
SRFI-78 check.rkt
|
||||
78<br>
|
||||
SRFI-86 86.ss
|
||||
SRFI-86 86.rkt
|
||||
86<br>
|
||||
SRFI-87 case.ss
|
||||
SRFI-87 case.rkt
|
||||
87<br>
|
||||
<EFBFBD><EFBFBD></p>
|
||||
</p>
|
||||
|
||||
|
||||
<p><b>Notes:</b></p>
|
||||
|
||||
|
||||
<p>+ Supported by the core of PLT Scheme<br>
|
||||
<p>+ Supported by the Racket core<br>
|
||||
<br>
|
||||
*1 The functionality is all part of mzscheme available
|
||||
via (lib"foreign.ss"), the only missing part is the i/o
|
||||
*1 The functionality is all part of racket available
|
||||
via (require ffi/unsafe), the only missing part is the i/o
|
||||
syntax.<br>
|
||||
<br>
|
||||
*2 The time module does not export its time structure
|
||||
|
@ -193,11 +193,11 @@
|
|||
the date-* accessors to tm:date-* so that you won't get
|
||||
errors when including this code in other modules. Care
|
||||
most be taken NOT to confuse the internal date structure
|
||||
with the PLT Scheme one, they are not the same, and all
|
||||
with the Racket one, they are not the same, and all
|
||||
procedures from this library expect the former.<br>
|
||||
<br>
|
||||
*3 This port also provides promise? / srfi-45-promise?.<br>
|
||||
<EFBFBD><EFBFBD></p>
|
||||
</p>
|
||||
|
||||
|
||||
<h2>Ported SRFIs: original documents</h2>
|
||||
|
@ -249,7 +249,7 @@
|
|||
<li><a href="srfi-71.html">SRFI 71: Extended LET-syntax for multiple values</a></li>
|
||||
<li><a href="srfi-74.html">SRFI 74: Octet-Addressed Binary Blocks</a></li>
|
||||
<li><a href="srfi-78.html">SRFI 78: Lightweight testing</a></li>
|
||||
<li><a href="srfi-86.html">SRFI 86: MU and NU simulating VALUES &
|
||||
<li><a href="srfi-86.html">SRFI 86: MU and NU simulating VALUES &
|
||||
CALL-WITH-VALUES, and their related LET-syntax</a></li>
|
||||
<li><a href="srfi-87.html">SRFI 87: => in case clauses</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -611,8 +611,7 @@ it might be good to use that code instead.
|
|||
|
||||
<h1>Acknowledgements</h1>
|
||||
|
||||
Claus
|
||||
Tøndering's<a href="http://www.tondering.dk/claus/calendar.html"> Frequently Asked Questions</a> about calendars was a very
|
||||
Claus Tøndering's<a href="http://www.tondering.dk/claus/calendar.html"> Frequently Asked Questions</a> about calendars was a very
|
||||
useful resource. The implementation of Julian Day, Modified Julian
|
||||
Day, and Year Day comes from his FAQ. Markus Kuhn has a <a
|
||||
href="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">useful
|
||||
|
|
|
@ -137,7 +137,7 @@ two data types.</font><p></p>
|
|||
<p align="justify"><font face="monospace"><pre>α stream
|
||||
:: (promise stream-null)
|
||||
| (promise (α stream-pair))</pre><pre>α stream-pair
|
||||
:: (promise α) × (promise (α stream))</pre></font></p>
|
||||
:: (promise α) × (promise (α stream))</pre></font></p>
|
||||
|
||||
<p align="justify"><font face="serif">The object
|
||||
stored in the </font><font face="monospace">stream-car</font><font face="serif"> of a </font><font face="monospace">stream-pair</font><font face="serif"> is a promise that is forced the first
|
||||
|
@ -364,7 +364,7 @@ See also </font><font face="monospace">list->stream</font><font face="serif">
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font><font face="monospace"><b>(stream->list
|
||||
[</b></font><font face="serif"><b><i>n</i></b></font><font face="monospace"><b>] </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">nat × {α} → [α]</font><br>
|
||||
<font face="monospace">nat × {α} → [α]</font><br>
|
||||
<font face="monospace">Stream->list</font><font face="serif"> takes a natural number <i>n</i> and
|
||||
a <i>stream</i> and returns a newly-allocated list containing in its
|
||||
elements the first <i>n</i> items in the <i>stream</i>. If the <i>stream</i>
|
||||
|
@ -473,7 +473,7 @@ repeating the <i>object</i>s in succession forever.</font></font></font></p>
|
|||
#t #f #t #f #t #f ...</font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font><font face="monospace"><b>(stream-drop </b></font><font face="serif"><b><i>n</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><font face="serif"><b> procedure </b></font><br>
|
||||
<font face="monospace">nat × {α} → {α}</font><br>
|
||||
<font face="monospace">nat × {α} → {α}</font><br>
|
||||
<font face="monospace">Stream-drop</font><font face="serif"> returns the suffix of the input <i>
|
||||
stream</i> that starts at the next element after the first <i>n</i>
|
||||
elements. The output stream shares structure with the input <i>
|
||||
|
@ -487,7 +487,7 @@ also </font><font face="monospace">stream-take</font><font face="serif">.</font>
|
|||
(stream-drop n strm)))</pre></font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font><font face="monospace"><b>(stream-drop-while </b></font><font face="serif"><b><i>pred?</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">Stream-drop-while</font><font face="serif"> returns the suffix of the input <i>
|
||||
stream</i> that starts at the first element <i>x</i> for which </font><font face="monospace">(pred? </font><font face="serif"><i>x</i></font><font face="monospace">)</font><font face="serif">
|
||||
is </font><font face="monospace">#f</font><font face="serif">.
|
||||
|
@ -509,7 +509,7 @@ only the first of any sub-sequences of repeated elements.</font></font></font></
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-filter </b></font><font face="serif"><b><i>pred?</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">Stream-filter</font><font face="serif"> returns a newly-allocated stream that
|
||||
contains only those elements <i>x</i> of the input <i>stream</i> for
|
||||
which </font><font face="monospace">(</font><font face="serif"><i>pred?</i></font><font face="monospace"> </font><font face="serif"><i>x</i></font><font face="monospace">)</font><font face="serif">
|
||||
|
@ -520,7 +520,7 @@ is non-</font><font face="monospace">#f</font><font face="serif">.</font></font>
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-fold </b></font><font face="serif"><b><i>proc</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>base</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α × β → α) × α × {β} → α</font><br>
|
||||
<font face="monospace">(α × β → α) × α × {β} → α</font><br>
|
||||
<font face="monospace">Stream-fold</font><font face="serif"> applies a binary <i>proc</i>edure
|
||||
to <i>base</i> and the first element of <i>stream</i> to compute a new <i>
|
||||
base</i>, then applies the <i>proc</i>edure to the new <i>base</i> and
|
||||
|
@ -572,7 +572,7 @@ it is useful to have </font><font face="monospace">stream-fold</font><font face=
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-for-each </b></font><font face="serif"><b><i>proc</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b> ...)</b></font><br>
|
||||
<font face="monospace">(α × β × ...) × {α} × {β} ...</font><br>
|
||||
<font face="monospace">(α × β × ...) × {α} × {β} ...</font><br>
|
||||
<font face="monospace">Stream-for-each</font><font face="serif"> applies a <i>proc</i>edure element-wise
|
||||
to corresponding elements of the input <i>stream</i>s for its side-effects;
|
||||
it returns nothing. </font><font face="monospace">Stream-for-each</font><font face="serif"> stops as soon as any of its input <i>
|
||||
|
@ -587,7 +587,7 @@ procedure displays the contents of a file:</font></font></font></p>
|
|||
<font face="serif"><b>procedure: </b></font>
|
||||
<b>(stream-from </b></font><font face="serif"><b><i>first</i></b></font><font face="monospace"><b>
|
||||
[</b></font><font face="serif"><b><i>step</i></b></font><font face="monospace"><b>])</b></font><br>
|
||||
<font face="monospace">number × number → {number}</font><br>
|
||||
<font face="monospace">number × number → {number}</font><br>
|
||||
<font face="monospace">Stream-from</font><font face="serif"> creates a newly-allocated stream that
|
||||
contains <i>first</i> as its first element and increments each succeeding
|
||||
element by <i>step</i>. If <i>step</i> is not given it defaults
|
||||
|
@ -605,7 +605,7 @@ for a similar procedure that creates finite streams.</font><font face="monospace
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-iterate proc base)</b></font><br>
|
||||
<font face="monospace">(α → α) × α → {α}</font><br>
|
||||
<font face="monospace">(α → α) × α → {α}</font><br>
|
||||
<font face="monospace">Stream-iterate</font><font face="serif"> creates a newly-allocated stream containing <i>
|
||||
base</i> in its first element and applies <i>proc</i> to each element
|
||||
in turn to determine the succeeding element. See also </font><font face="monospace">stream-unfold</font><font face="serif">
|
||||
|
@ -681,7 +681,7 @@ with a </font><font face="monospace">stream-car</font><font face="serif"> <i>x</
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-map </b></font><font face="serif"><b><i>proc stream</i> </b></font><font face="monospace"><b>...)</b></font><br>
|
||||
<font face="monospace">(α × β ... → ω) × {α} × {β} ... → {ω}</font><br>
|
||||
<font face="monospace">(α × β ... → ω) × {α} × {β} ... → {ω}</font><br>
|
||||
<font face="monospace">Stream-map</font><font face="serif"> applies a <i>proc</i>edure element-wise
|
||||
to corresponding elements of the input <i>stream</i>s, returning a newly-allocated
|
||||
stream containing elements that are the results of those <i>proc</i>edure
|
||||
|
@ -841,7 +841,7 @@ containing only the element </font><font face="monospace">1</font><font face="se
|
|||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-range </b></font><font face="serif"><b><i>first</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>past</i></b></font><font face="monospace"><b>
|
||||
[</b></font><font face="serif"><b><i>step</i></b></font><font face="monospace"><b>])</b></font><br>
|
||||
<font face="monospace">number × number × number → {number}</font><br>
|
||||
<font face="monospace">number × number × number → {number}</font><br>
|
||||
<font face="monospace">Stream-range</font><font face="serif"> creates a newly-allocated stream that
|
||||
contains <i>first</i> as its first element and increments each succeeding
|
||||
element by <i>step</i>. The stream is finite and ends before <i>
|
||||
|
@ -868,7 +868,7 @@ length of the output stream may differ from </font><font face="monospace">(ceili
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-ref </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>n</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">{α} × nat → α</font><br>
|
||||
<font face="monospace">{α} × nat → α</font><br>
|
||||
<font face="monospace">Stream-ref</font><font face="serif"> returns the <i>n</i>th element of <i>
|
||||
stream</i>, counting from zero. An error is signaled if <i>n</i>
|
||||
is greater than or equal to the length of <i>stream</i>.</font><font face="monospace"> </font></font></font></p>
|
||||
|
@ -897,7 +897,7 @@ error: division by zero</pre></font></font></font></p>
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-scan </b></font><font face="serif"><b><i>proc</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>base</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α × β → α) × α × {β} → {α}</font><br>
|
||||
<font face="monospace">(α × β → α) × α × {β} → {α}</font><br>
|
||||
<font face="monospace">Stream-scan</font><font face="serif"> accumulates the partial folds of an
|
||||
input <i>stream</i> into a newly-allocated output stream. The
|
||||
output stream is the <i>base</i> followed by </font><font face="monospace">(stream-fold
|
||||
|
@ -912,7 +912,7 @@ for each of the first <i>i</i> elements of <i>stream</i>.</font></font></font></
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-take </b></font><font face="serif"><b><i>n</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">nat × {α} → {α}</font><br>
|
||||
<font face="monospace">nat × {α} → {α}</font><br>
|
||||
<font face="monospace">Stream-take</font><font face="serif"> takes a non-negative integer <i>n</i>
|
||||
and a <i>stream</i> and returns a newly-allocated stream containing
|
||||
the first <i>n</i> elements of the input <i>stream</i>. If the
|
||||
|
@ -934,7 +934,7 @@ the results:</font></font></font></p>
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-take-while </b></font><font face="serif"><b><i>pred?</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">(α → boolean) × {α} → {α}</font><br>
|
||||
<font face="monospace">Stream-take-while</font><font face="serif"> takes a predicate and a <i>stream</i>
|
||||
and returns a newly-allocated stream containing those elements <i>x</i>
|
||||
that form the maximal prefix of the input <i>stream</i> for which </font><font face="monospace">(pred? </font><font face="serif"><i>x</i></font><font face="monospace">)</font><font face="serif">
|
||||
|
@ -949,7 +949,7 @@ See also </font><font face="monospace">stream-drop-while</font><font face="serif
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-unfold </b></font><font face="serif"><b><i>map</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>pred?</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>gen</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>base</i>)</b></font><br>
|
||||
<font face="monospace">(α → β) × (α → boolean) × (α → α) × α → {β}</font><br>
|
||||
<font face="monospace">(α → β) × (α → boolean) × (α → α) × α → {β}</font><br>
|
||||
<font face="monospace">Stream-unfold</font><font face="serif"> is the fundamental recursive stream
|
||||
constructor. It constructs a stream by repeatedly applying <i>
|
||||
gen</i> to successive values of <i>base</i>, in the manner of </font><font face="monospace">stream-iterate</font><font face="serif">,
|
||||
|
@ -975,7 +975,7 @@ and </font><font face="monospace">stream-null</font><font face="serif"> ends the
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-unfolds </b></font><font face="serif"><b><i>proc</i></b></font><font face="monospace"><b> </b></font><font face="serif"><b><i>seed</i></b></font><font face="monospace"><b>)</b></font><br>
|
||||
<font face="monospace">(α → (values α × β ...)) × α → (values {β} ...)</font><br>
|
||||
<font face="monospace">(α → (values α × β ...)) × α → (values {β} ...)</font><br>
|
||||
<font face="monospace">Stream-unfolds</font><font face="serif"> returns <i>n</i> newly-allocated streams
|
||||
containing those elements produced by successive calls to the generator <i>
|
||||
proc</i>, which takes the current <i>seed</i> as its argument and returns <i>
|
||||
|
@ -1038,7 +1038,7 @@ pred?</i> once for each element of <i>strm</i>.</font></font></font></p>
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif"><b>procedure: </b></font>
|
||||
<font face="monospace"><b>(stream-zip </b></font><font face="serif"><b><i>stream</i></b></font><font face="monospace"><b> ...)</b></font><br>
|
||||
<font face="monospace">{α} × {β} × ... → {[α β ...]}</font><br>
|
||||
<font face="monospace">{α} × {β} × ... → {[α β ...]}</font><br>
|
||||
<font face="monospace">Stream-zip</font><font face="serif"> takes one or more input <i>stream</i>s
|
||||
and returns a newly-allocated stream in which each element is a list
|
||||
(not a stream) of the corresponding elements of the input <i>stream</i>s.
|
||||
|
@ -1210,7 +1210,7 @@ the offset trick is this definition of the fibonacci numbers:</font></font></fon
|
|||
sequence that uses the same offset trick is the Hamming numbers, named
|
||||
for the mathematician and computer scientist Richard Hamming, defined
|
||||
as all numbers that have no prime factors greater than 5; in other words,
|
||||
Hamming numbers are all numbers expressible as 2<sup><i>i</i></sup>·3<sup><i>j</i></sup>·5<sup><i>k</i></sup>,
|
||||
Hamming numbers are all numbers expressible as 2<sup><i>i</i></sup>·3<sup><i>j</i></sup>·5<sup><i>k</i></sup>,
|
||||
where <i>i</i>, <i>j</i> and <i>k</i> are non-negative integers. The
|
||||
Hamming sequence starts with </font><font face="monospace">1
|
||||
2 3 4 5 6 8 9 10 12</font><font face="serif"> and
|
||||
|
@ -2007,7 +2007,7 @@ the suspension through the two constructors of the stream data type:</font></fon
|
|||
| (promise (α stream-pair))</pre></font></font></font></p>
|
||||
|
||||
<p><font face="serif"><font face="serif"><font face="monospace"><pre>α stream-pair
|
||||
:: α × (α stream)</pre></font></font></font></p>
|
||||
:: α × (α stream)</pre></font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">That type captures
|
||||
the systematic suspension of recursive promises that is the essence
|
||||
|
@ -2021,7 +2021,7 @@ the car and the cdr of the stream-pair:</font></font></font></p>
|
|||
| (promise (α stream-pair))</pre></font></font></font></p>
|
||||
|
||||
<p><font face="serif"><font face="serif"><font face="monospace"><pre>α stream-pair
|
||||
:: (promise α) × (promise (α stream))</pre></font></font></font></p>
|
||||
:: (promise α) × (promise (α stream))</pre></font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">The two outer
|
||||
promises, in the </font><font face="monospace">stream</font><font face="serif"> type, provide streams without memoization.
|
||||
|
@ -2034,7 +2034,7 @@ can be derived from those primitives.</font></font></font></p>
|
|||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">It would seem
|
||||
that the same set of primitives could apply to streams, but in fact
|
||||
one additional primitive is required. André van Tonder describes
|
||||
one additional primitive is required. André van Tonder describes
|
||||
the reason in his discussion of the promise data type. The promises
|
||||
of R6RS are inadequate to support iterative algorithms because each
|
||||
time a promise is called iteratively it binds the old promise in the
|
||||
|
@ -2076,8 +2076,8 @@ hardest tasks when writing any program library is to decide what to
|
|||
include and, more importantly, what to exclude. One important
|
||||
guideline is minimalism, since once an operator enters a library it
|
||||
must remain forever: <i>Il semble que la perfection soit atteinte non
|
||||
quand il n’y a plus rien à ajouter, mais quand il n’y a plus rien
|
||||
à retrancher</i>.</font></font></font></p>
|
||||
quand il n’y a plus rien à ajouter, mais quand il n’y a plus rien
|
||||
à retrancher</i>.</font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">Since streams
|
||||
are substantially slower than lists (the stream primitives require numerous
|
||||
|
@ -2625,7 +2625,7 @@ Elements of Functional Programming</i>. Addison-Wesley, April
|
|||
1989. A textbook on functional programming.</font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">Antoine de
|
||||
Saint-Exupéry. Chapter III “L’Avion” of <i>Terre des Hommes</i>.
|
||||
Saint-Exupéry. Chapter III “L’Avion” of <i>Terre des Hommes</i>.
|
||||
1939. “Perfection is achieved, not when there is nothing more
|
||||
to add, but when there is nothing left to take away.”</font></font></font></p>
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ Revised</i><sup><i>6</i></sup><i> Report on the Algorithmic Language
|
|||
Scheme</i>. September 26, 2007. </font><font face="monospace"><a href="http://www.r6rs.org/" target="_blank">www.r6rs.org</a></font><font face="serif">. The standard definition of
|
||||
the Scheme programming language.</font></font></font></p>
|
||||
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">André van
|
||||
<p align="justify"><font face="serif"><font face="serif"><font face="serif">André van
|
||||
Tonder. <i>Scheme Request for Implementation 45:
|
||||
Primitives for Expressing Iterative Lazy Algorithms</i>. </font><font face="monospace"><a href="http://srfi.schemers.org/srfi-45" target="_blank">srfi.schemers.org/srfi-45</a></font><font face="serif">.
|
||||
April, 2004. Describes the problems inherent in the </font><font face="monospace">promise</font><font face="serif">
|
||||
|
|
|
@ -742,7 +742,7 @@ Richard Jones. <em>Tail recursion without space leaks</em>, Journal of Functiona
|
|||
[Fee97]
|
||||
Marc Feeley, James S. Miller, Guillermo J. Rozas, Jason A. Wilson,
|
||||
<em> Compiling Higher-Order Languages into Fully Tail-Recursive Portable C</em>,
|
||||
Rapport technique 1078, département d'informatique et r.o., Université de Montréal, août 1997.
|
||||
Rapport technique 1078, département d'informatique et r.o., Université de Montréal, août 1997.
|
||||
|
||||
|
||||
|
||||
|
@ -775,7 +775,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
</p>
|
||||
|
||||
<hr>
|
||||
<address>Author: <a href="mailto:andre@het.brown.edu">André van Tonder</a></address>
|
||||
<address>Author: <a href="mailto:andre@het.brown.edu">André van Tonder</a></address>
|
||||
<address>Editor: <a href="mailto:srfi-editors@srfi.schemers.org">Francisco Solsona</a></address>
|
||||
<!-- Created: Fri Sep 19 17:55:00 EST 2002 -->
|
||||
<!-- hhmts start -->
|
||||
|
|
|
@ -143,18 +143,18 @@ unique.
|
|||
<p>
|
||||
<pre>
|
||||
let = "(" "let" let-bindings body ")"
|
||||
expressions = nothing | expression expressions
|
||||
let-bindings = let-name bindings
|
||||
| "(" let-name "." bindings ")"
|
||||
let-name = identifier
|
||||
bindings = "(" ")"
|
||||
expressions = nothing | expression expressions
|
||||
let-bindings = let-name bindings
|
||||
| "(" let-name "." bindings ")"
|
||||
let-name = identifier
|
||||
bindings = "(" ")"
|
||||
| rest-binding
|
||||
| "(" normal-bindings ["." rest-binding] ")"
|
||||
normal-bindings = nothing
|
||||
| normal-binding normal-bindings
|
||||
normal-binding = "(" binding-name expression ")"
|
||||
binding-name = identifier
|
||||
rest-binding = "(" binding-name expressions ")"
|
||||
normal-binding = "(" binding-name expression ")"
|
||||
binding-name = identifier
|
||||
rest-binding = "(" binding-name expressions ")"
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue
Block a user