File: r6rs-lib-Z-H-20.html

package info (click to toggle)
plt-scheme 4.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 74,572 kB
  • ctags: 54,545
  • sloc: ansic: 305,271; cpp: 65,061; sh: 30,815; lisp: 10,555; asm: 8,532; makefile: 5,174; perl: 2,930; java: 2,652; pascal: 2,011; yacc: 755; lex: 258; sed: 93; xml: 12; python: 8
file content (281 lines) | stat: -rw-r--r-- 16,004 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!--

Generated from r6rs-lib.tex by tex2page, v 20070803
(running on MzScheme 371, unix), 
(c) Dorai Sitaram, 
http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html

-->
<head>
<title>
r6rs-lib
</title>
<link rel="stylesheet" type="text/css" href="r6rs-lib-Z-S.css" title=default>
<meta name=robots content="index,follow">
</head>
<body>
<div id=slidecontent>
<div align=right class=navigation>[Go to <span><a href="r6rs-lib.html">first</a>, <a href="r6rs-lib-Z-H-19.html">previous</a></span><span>, <a href="r6rs-lib-Z-H-21.html">next</a></span> page<span>; &nbsp;&nbsp;</span><span><a href="r6rs-lib-Z-H-1.html#node_toc_start">contents</a></span><span><span>; &nbsp;&nbsp;</span><a href="r6rs-lib-Z-H-21.html#node_index_start">index</a></span>]</div>
<p></p>
<a name="node_chap_19"></a>
<h1 class=chapter>
<div class=chapterheading><a href="r6rs-lib-Z-H-1.html#node_toc_node_chap_19">Chapter 19</a></div><br>
<a href="r6rs-lib-Z-H-1.html#node_toc_node_chap_19">R<sup>5</sup>RS compatibility</a></h1>
<p></p>
<p>
The features described in this chapter are exported from the
<tt>(rnrs r5rs (6))</tt><a name="node_idx_1284"></a>library and provide some functionality of the
preceding revision of this report&nbsp;[<a href="r6rs-lib-Z-H-21.html#node_bib_8">8</a>] that was omitted from
the main part of the current report.</p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1286"></a>exact-&gt;inexact<i> z</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>

<div align=left><tt>(<a name="node_idx_1288"></a>inexact-&gt;exact<i> z</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>
<p>
These are the same as the <tt>inexact</tt> and <tt>exact</tt>
procedures; see report section&nbsp;on &#8220;Generic conversions&#8221;.
</p>
<p></p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1290"></a>quotient<i> <i>n<sub>1</sub></i> <i>n<sub>2</sub></i></i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>

<div align=left><tt>(<a name="node_idx_1292"></a>remainder<i> <i>n<sub>1</sub></i> <i>n<sub>2</sub></i></i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>

<div align=left><tt>(<a name="node_idx_1294"></a>modulo<i> <i>n<sub>1</sub></i> <i>n<sub>2</sub></i></i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>
<p>
These procedures implement number-theoretic (integer)
division.  <i>N<sub>2</sub></i> must be non-zero.  All three procedures
return integer objects.  If <i>n<sub>1</sub></i>/<i>n<sub>2</sub></i> is an integer object:
</p>

<tt>&nbsp;&nbsp;&nbsp;&nbsp;(quotient&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;<i>n<sub>1</sub></i>/<i>n<sub>2</sub></i><br>
&nbsp;&nbsp;&nbsp;&nbsp;(remainder&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;0<br>
&nbsp;&nbsp;&nbsp;&nbsp;(modulo&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;0<br>
<p></tt>
If <i>n<sub>1</sub></i>/<i>n<sub>2</sub></i> is not an integer object:
</p>

<tt>&nbsp;&nbsp;&nbsp;&nbsp;(quotient&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;<i>n<sub><em>q</em></sub></i><br>
&nbsp;&nbsp;&nbsp;&nbsp;(remainder&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;<i>n<sub><em>r</em></sub></i><br>
&nbsp;&nbsp;&nbsp;&nbsp;(modulo&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;<i>n<sub><em>m</em></sub></i><br>
<p></tt>
where <i>n<sub><em>q</em></sub></i> is <i>n<sub>1</sub></i>/<i>n<sub>2</sub></i> rounded towards zero,
0 &lt; |<i>n<sub><em>r</em></sub></i>| &lt; |<i>n<sub>2</sub></i>|, 0 &lt; |<i>n<sub><em>m</em></sub></i>| &lt; |<i>n<sub>2</sub></i>|,
<i>n<sub><em>r</em></sub></i> and <i>n<sub><em>m</em></sub></i> differ from <i>n<sub>1</sub></i> by a multiple of <i>n<sub>2</sub></i>,
<i>n<sub><em>r</em></sub></i> has the same sign as <i>n<sub>1</sub></i>, and
<i>n<sub><em>m</em></sub></i> has the same sign as <i>n<sub>2</sub></i>.</p>
<p>
Consequently, for integer objects <i>n<sub>1</sub></i> and <i>n<sub>2</sub></i> with
<i>n<sub>2</sub></i> not equal to 0,
</p>

<tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(=&nbsp;<i>n<sub>1</sub></i>&nbsp;(+&nbsp;(*&nbsp;<i>n<sub>2</sub></i>&nbsp;(quotient&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(remainder&nbsp;<i>n<sub>1</sub></i>&nbsp;<i>n<sub>2</sub></i>)))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;<tt>#t</tt><p></tt>
provided all number object involved in that computation are exact.</p>
<p>
</p>

<tt>(modulo&nbsp;13&nbsp;4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;1<br>
(remainder&nbsp;13&nbsp;4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;1<br>
<br>
(modulo&nbsp;-13&nbsp;4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;3<br>
(remainder&nbsp;-13&nbsp;4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;-1<br>
<br>
(modulo&nbsp;13&nbsp;-4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;-3<br>
(remainder&nbsp;13&nbsp;-4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;1<br>
<br>
(modulo&nbsp;-13&nbsp;-4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;-1<br>
(remainder&nbsp;-13&nbsp;-4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;-1<br>
<br>
(remainder&nbsp;-13&nbsp;-4.0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;-1.0<p></tt></p>
<p>
</p>
<blockquote><em>Note:&nbsp;&nbsp;</em>
These procedures could be defined in terms of <tt>div</tt> and <tt>mod</tt> (see report section&nbsp;on &#8220;Arithmetic operations&#8221;) as follows (without checking of the
argument types):

<tt>(define&nbsp;(sign&nbsp;n)<br>
&nbsp;&nbsp;(cond<br>
&nbsp;&nbsp;&nbsp;&nbsp;((negative?&nbsp;n)&nbsp;-1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;((positive?&nbsp;n)&nbsp;1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;(else&nbsp;0)))<br>
<br>
(define&nbsp;(quotient&nbsp;n1&nbsp;n2)<br>
&nbsp;&nbsp;(*&nbsp;(sign&nbsp;n1)&nbsp;(sign&nbsp;n2)&nbsp;(div&nbsp;(abs&nbsp;n1)&nbsp;(abs&nbsp;n2))))<br>
<br>
(define&nbsp;(remainder&nbsp;n1&nbsp;n2)<br>
&nbsp;&nbsp;(*&nbsp;(sign&nbsp;n1)&nbsp;(mod&nbsp;(abs&nbsp;n1)&nbsp;(abs&nbsp;n2))))<br>
<br>
(define&nbsp;(modulo&nbsp;n1&nbsp;n2)<br>
&nbsp;&nbsp;(*&nbsp;(sign&nbsp;n2)&nbsp;(mod&nbsp;(*&nbsp;(sign&nbsp;n2)&nbsp;n1)&nbsp;(abs&nbsp;n2))))<br>
<p></tt>
</p>
</blockquote>
<p></p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1296"></a>delay<i> &lt;expression&gt;</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;syntax&nbsp;</div>
<p>
The <tt>delay</tt> construct is used together with the procedure <tt>force</tt> to
implement <a name="node_idx_1298"></a><em>lazy evaluation</em> or <a name="node_idx_1300"></a><em>call by need</em>.
<tt>(delay&nbsp;&lt;expression&gt;)</tt> returns an object called a
<a name="node_idx_1302"></a><em>promise</em> which at some point in the future may be asked (by
the <tt>force</tt> procedure) to evaluate
&lt;expression&gt;, and deliver the resulting value.
The effect of &lt;expression&gt; returning multiple values
is unspecified.</p>
<p>
</p>
<p></p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1304"></a>force<i> promise</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>
<p>
<i>Promise</i> must be a promise.
The <tt>force</tt> procedure forces the value of <i>promise</i>.  If no value has been computed for
the promise, then a value is computed and returned.  The value of the
promise is cached (or &#8220;memoized&#8221;) so that if it is forced a second
time, the previously computed value is returned.</p>
<p>
</p>

<tt>(force&nbsp;(delay&nbsp;(+&nbsp;1&nbsp;2)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;3<br>
(let&nbsp;((p&nbsp;(delay&nbsp;(+&nbsp;1&nbsp;2))))<br>
&nbsp;&nbsp;(list&nbsp;(force&nbsp;p)&nbsp;(force&nbsp;p)))&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;(3&nbsp;3)<br>
<br>
(define&nbsp;a-stream<br>
&nbsp;&nbsp;(letrec&nbsp;((next<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(lambda&nbsp;(n)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(cons&nbsp;n&nbsp;(delay&nbsp;(next&nbsp;(+&nbsp;n&nbsp;1)))))))<br>
&nbsp;&nbsp;&nbsp;&nbsp;(next&nbsp;0)))<br>
(define&nbsp;head&nbsp;car)<br>
(define&nbsp;tail<br>
&nbsp;&nbsp;(lambda&nbsp;(stream)&nbsp;(force&nbsp;(cdr&nbsp;stream))))<br>
<br>
(head&nbsp;(tail&nbsp;(tail&nbsp;a-stream)))&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;2<p></tt></p>
<p>
Promises are mainly intended for programs written in
functional style.  The following examples should not be considered to
illustrate good programming style, but they illustrate the property that
only one value is computed for a promise, no matter how many times it is
forced.</p>
<p>
</p>

<tt>(define&nbsp;count&nbsp;0)<br>
(define&nbsp;p<br>
&nbsp;&nbsp;(delay&nbsp;(begin&nbsp;(set!&nbsp;count&nbsp;(+&nbsp;count&nbsp;1))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;(&gt;&nbsp;count&nbsp;x)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(force&nbsp;p)))))<br>
(define&nbsp;x&nbsp;5)<br>
p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;<i>a&nbsp;promise</i><br>
(force&nbsp;p)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;6<br>
p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;<i>a&nbsp;promise,&nbsp;still</i><br>
(begin&nbsp;(set!&nbsp;x&nbsp;10)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(force&nbsp;p))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&rArr;&nbsp;&nbsp;6<p></tt></p>
<p>
Here is a possible implementation of <tt>delay</tt> and <tt>force</tt>.
Promises are implemented here as procedures of no arguments,
and <tt>force</tt> simply calls its argument:</p>
<p>
</p>

<tt>(define&nbsp;force<br>
&nbsp;&nbsp;(lambda&nbsp;(object)<br>
&nbsp;&nbsp;&nbsp;&nbsp;(object)))<p></tt></p>
<p>
The expression</p>
<p>
</p>

<tt>(delay&nbsp;&lt;expression&gt;)<p></tt></p>
<p>
has the same meaning as the procedure call</p>
<p>
</p>

<tt>(make-promise&nbsp;(lambda&nbsp;()&nbsp;&lt;expression&gt;))<p></tt></p>
<p>
as follows</p>
<p>
</p>

<tt>(define-syntax&nbsp;delay<br>
&nbsp;&nbsp;(syntax-rules&nbsp;()<br>
&nbsp;&nbsp;&nbsp;&nbsp;((delay&nbsp;expression)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(make-promise&nbsp;(lambda&nbsp;()&nbsp;expression))))),<p></tt></p>
<p>
where <tt>make-promise</tt> is defined as follows:</p>
<p>
</p>

<tt>(define&nbsp;make-promise<br>
&nbsp;&nbsp;(lambda&nbsp;(proc)<br>
&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;((result-ready?&nbsp;<tt>#f</tt>)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(result&nbsp;<tt>#f</tt>))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(lambda&nbsp;()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;result-ready?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(let&nbsp;((x&nbsp;(proc)))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(if&nbsp;result-ready?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(begin&nbsp;(set!&nbsp;result-ready?&nbsp;<tt>#t</tt>)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(set!&nbsp;result&nbsp;x)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result))))))))<p></tt>
</p>
<p></p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1306"></a>null-environment<i> n</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>
<p>
<i>N</i> must be the exact integer object 5.  The <tt>null-environment</tt> procedure returns an
environment specifier suitable for use with <tt>eval</tt> (see
chapter&nbsp;<a href="r6rs-lib-Z-H-17.html#node_chap_16">16</a>) representing an environment that is empty except
for the (syntactic) bindings for all keywords described in
the previous revision of this report&nbsp;[<a href="r6rs-lib-Z-H-21.html#node_bib_8">8</a>], including bindings
for <tt>=&gt;</tt>, <tt>...</tt>, <tt>else</tt>, and <tt>_</tt> that are the same as those in
the <tt>(rnrs base (6))</tt> library.
</p>
<p></p>
<p>
</p>
<p></p>
<div align=left><tt>(<a name="node_idx_1308"></a>scheme-report-environment<i> n</i>)</tt>&nbsp;&nbsp;&nbsp;&nbsp;procedure&nbsp;</div>
<p>
<i>N</i> must be the exact integer object 5.  The <tt>scheme-report-environment</tt> procedure returns
an environment specifier for an environment that is empty except for
the bindings for the identifiers described in the previous
revision of this report&nbsp;[<a href="r6rs-lib-Z-H-21.html#node_bib_8">8</a>], omitting <tt>load</tt>, <tt>interaction-environment</tt>, <tt>transcript-on</tt>, <tt>transcript-off</tt>, and <tt>char-ready?</tt>.  The
variable bindings have as values the procedures of the same names described in
this report, and the keyword bindings, including
<tt>=&gt;</tt>, <tt>...</tt>, <tt>else</tt>, and <tt>_</tt> are the same as those described
in this report.
</p>
<p></p>
<p>
 </p>
<p></p>
<p>

</p>
<div class=smallskip></div>
<p style="margin-top: 0pt; margin-bottom: 0pt">
<div align=right class=navigation>[Go to <span><a href="r6rs-lib.html">first</a>, <a href="r6rs-lib-Z-H-19.html">previous</a></span><span>, <a href="r6rs-lib-Z-H-21.html">next</a></span> page<span>; &nbsp;&nbsp;</span><span><a href="r6rs-lib-Z-H-1.html#node_toc_start">contents</a></span><span><span>; &nbsp;&nbsp;</span><a href="r6rs-lib-Z-H-21.html#node_index_start">index</a></span>]</div>
</p>
<p></p>
</div>
</body>
</html>