This file is indexed.

/usr/share/doc/r5rs-doc/r5rs/Binding-constructs.html is in r5rs-doc 20010328-7.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
<html lang="en">
<head>
<title>Binding constructs - Revised(5) Scheme</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Revised(5) Scheme">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Derived-expression-types.html#Derived-expression-types" title="Derived expression types">
<link rel="prev" href="Conditional.html#Conditional" title="Conditional">
<link rel="next" href="Sequencing.html#Sequencing" title="Sequencing">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Binding-constructs"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Sequencing.html#Sequencing">Sequencing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Conditional.html#Conditional">Conditional</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Derived-expression-types.html#Derived-expression-types">Derived expression types</a>
<hr>
</div>

<h4 class="subsection">4.2.2 Binding constructs</h4>

<p><a name="index-g_t_0040w_007bbinding-constructs_007d-119"></a>
The three binding constructs &lsquo;<samp><span class="samp">let</span></samp>&rsquo;, &lsquo;<samp><span class="samp">let*</span></samp>&rsquo;, and &lsquo;<samp><span class="samp">letrec</span></samp>&rsquo;
give Scheme a block structure, like Algol 60.  The syntax of the three
constructs is identical, but they differ in the regions they establish
<a name="index-g_t_0040w_007bregion_007d-120"></a>for their variable bindings.  In a &lsquo;<samp><span class="samp">let</span></samp>&rsquo; expression, the initial
values are computed before any of the variables become bound; in a
&lsquo;<samp><span class="samp">let*</span></samp>&rsquo; expression, the bindings and evaluations are performed
sequentially; while in a &lsquo;<samp><span class="samp">letrec</span></samp>&rsquo; expression, all the bindings are in
effect while their initial values are being computed, thus allowing
mutually recursive definitions.

<div class="defun">
&mdash; library syntax: <b>let</b><var> &lt;bindings&gt; &lt;body&gt;<a name="index-let-121"></a></var><br>
<blockquote>
     <p><em>Syntax:</em>
<span class="roman">&lt;Bindings&gt;</span> should have the form

     <pre class="format"><tt>((</tt><span class="roman">&lt;variable1&gt;</span> <span class="roman">&lt;init1&gt;</span><tt>) <small class="dots">...</small>)</tt><span class="roman">,</span>
     
</pre>
     <p>where each <span class="roman">&lt;init&gt;</span> is an expression, and <span class="roman">&lt;body&gt;</span> should be a
sequence of one or more expressions.  It is
an error for a <span class="roman">&lt;variable&gt;</span> to appear more than once in the list of variables
being bound.

     <p><em>Semantics:</em>
The <span class="roman">&lt;init&gt;</span>s are evaluated in the current environment (in some
unspecified order), the <span class="roman">&lt;variable&gt;</span>s are bound to fresh locations
holding the results, the <span class="roman">&lt;body&gt;</span> is evaluated in the extended
environment, and the value(s) of the last expression of <span class="roman">&lt;body&gt;</span>
is(are) returned.  Each binding of a <span class="roman">&lt;variable&gt;</span> has <span class="roman">&lt;body&gt;</span> as its
region.

     <pre class="format"><tt>(let ((x 2) (y 3))
       (* x y))                             ==&gt;  6
     
     (let ((x 2) (y 3))
       (let ((x 7)
             (z (+ x y)))
         (* z x)))                          ==&gt;  35
     </tt>
</pre>
     <p>See also named &lsquo;<samp><span class="samp">let</span></samp>&rsquo;, section <a href="Iteration.html#Iteration">Iteration</a>.

     </blockquote></div>

<div class="defun">
&mdash; library syntax: <b>let*</b><var> &lt;bindings&gt; &lt;body&gt;<a name="index-let_002a-122"></a></var><br>
<blockquote>
     <p><em>Syntax:</em>
<span class="roman">&lt;Bindings&gt;</span> should have the form

     <pre class="format"><tt>((</tt><span class="roman">&lt;variable1&gt;</span> <span class="roman">&lt;init1&gt;</span><tt>) <small class="dots">...</small>)</tt><span class="roman">,</span>
     
</pre>
     <p>and <span class="roman">&lt;body&gt;</span> should be a sequence of
one or more expressions.

     <p><em>Semantics:</em>
&lsquo;<samp><span class="samp">Let*</span></samp>&rsquo; is similar to &lsquo;<samp><span class="samp">let</span></samp>&rsquo;, but the bindings are performed
sequentially from left to right, and the region of a binding indicated
by &lsquo;<samp><span class="samp">(&lt;variable&gt; &lt;init&gt;)</span></samp>&rsquo; is that part of the &lsquo;<samp><span class="samp">let*</span></samp>&rsquo;
expression to the right of the binding.  Thus the second binding is done
in an environment in which the first binding is visible, and so on.

     <pre class="format"><tt>(let ((x 2) (y 3))
       (let* ((x 7)
              (z (+ x y)))
         (* z x)))                          ==&gt;  70
     </tt>
</pre>
     </blockquote></div>

<div class="defun">
&mdash; library syntax: <b>letrec</b><var> &lt;bindings&gt; &lt;body&gt;<a name="index-letrec-123"></a></var><br>
<blockquote>
     <p><em>Syntax:</em>
<span class="roman">&lt;Bindings&gt;</span> should have the form

     <pre class="format"><tt>((</tt><span class="roman">&lt;variable1&gt;</span> <span class="roman">&lt;init1&gt;</span><tt>) <small class="dots">...</small>)</tt><span class="roman">,</span>
     
</pre>
     <p>and <span class="roman">&lt;body&gt;</span> should be a sequence of
one or more expressions. It is an error for a <span class="roman">&lt;variable&gt;</span> to appear more
than once in the list of variables being bound.

     <p><em>Semantics:</em>
The <span class="roman">&lt;variable&gt;</span>s are bound to fresh locations holding undefined
values, the <span class="roman">&lt;init&gt;</span>s are evaluated in the resulting environment (in
some unspecified order), each <span class="roman">&lt;variable&gt;</span> is assigned to the result
of the corresponding <span class="roman">&lt;init&gt;</span>, the <span class="roman">&lt;body&gt;</span> is evaluated in the
resulting environment, and the value(s) of the last expression in
<span class="roman">&lt;body&gt;</span> is(are) returned.  Each binding of a <span class="roman">&lt;variable&gt;</span> has the
entire &lsquo;<samp><span class="samp">letrec</span></samp>&rsquo; expression as its region, making it possible to
define mutually recursive procedures.

     <pre class="format"><tt><!-- (letrec ((x 2) (y 3)) -->
     <!-- (letrec ((foo (lambda (z) (+ x y z))) (x 7)) -->
     <!-- (foo 4)))                   \ev  14 -->
     
     (letrec ((even?
               (lambda (n)
                 (if (zero? n)
                     #t
                     (odd? (- n 1)))))
              (odd?
               (lambda (n)
                 (if (zero? n)
                     #f
                     (even? (- n 1))))))
       (even? 88))
                                            ==&gt;  #t
     </tt>
</pre>
     <p>One restriction on &lsquo;<samp><span class="samp">letrec</span></samp>&rsquo; is very important: it must be possible
to evaluate each <span class="roman">&lt;init&gt;</span> without assigning or referring to the value of any
<span class="roman">&lt;variable&gt;</span>.  If this restriction is violated, then it is an error.  The
restriction is necessary because Scheme passes arguments by value rather than by
name.  In the most common uses of &lsquo;<samp><span class="samp">letrec</span></samp>&rsquo;, all the <span class="roman">&lt;init&gt;</span>s are
lambda expressions and the restriction is satisfied automatically.

     <!-- \todo{use or uses?  - Jinx.} -->
     </blockquote></div>

</body></html>