<div dir="ltr"><div dir="ltr">Thanks for the fast reply.<br>One thing I don&#39;t understand: &#39;exp&#39; is bounded without scheme/base. What is so special about the new binding in scheme/base?<br>For example, the following code works fine:<br>
<br><span style="font-family: courier new,monospace;">(define foo</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">  (lambda (x)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    (* x x)))</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(define foo</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">  (lambda (b e)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    (if (= e 0) 1</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        (* b (foo b (- e 1))))))</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(foo 2 5)</span><br style="font-family: courier new,monospace;">
<br>I bind foo twice with different parameters, but its working!<br></div><br>
<br><br><div class="gmail_quote">On Tue, Mar 8, 2011 at 2:50 PM, Sam Tobin-Hochstadt <span dir="ltr">&lt;<a href="mailto:samth@ccs.neu.edu">samth@ccs.neu.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
`scheme/base&#39; provides a binding called `exp&#39;, which requires 2<br>
arguments.  When the compiler expands your definition, it looks at the<br>
variable reference in the body of the function *before* it binds your<br>
new `exp&#39; definition.  Therefore, it uses the `exp&#39; that it has in<br>
scope at that time -- the one from `scheme/base&#39;.<br>
<br>
This is an instance of a general problem with compilation and<br>
expansion at the top-level, and one of the many reasons why it&#39;s<br>
better to write programs in modules.<br>
<div><div></div><div class="h5"><br>
On Tue, Mar 8, 2011 at 7:37 AM, Yaron Gonen &lt;<a href="mailto:yaron.gonen@gmail.com">yaron.gonen@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt; (I&#39;m using Dr Scheme version 4.2.2, with language R5RS, and the &quot;Disallow<br>
&gt; redefining&quot; is not checked.)<br>
&gt;<br>
&gt; The following code works perfectly:<br>
&gt; (define exp<br>
&gt;   (lambda (b e)<br>
&gt;     (if (= e 0) 1<br>
&gt;         (* b (exp b (- e 1))))))<br>
&gt; (exp 2 5)<br>
&gt;<br>
&gt; However, when I include the line (#%require scheme/base), I get an error:<br>
&gt; exp: expects 1 argument, given 2: 2 4<br>
&gt;<br>
&gt; How is that possible?<br>
&gt;<br>
&gt; Many thanks,<br>
&gt; Yaron<br>
&gt;<br>
</div></div>&gt; _________________________________________________<br>
&gt;  For list-related administrative tasks:<br>
&gt;  <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
sam th<br>
<a href="mailto:samth@ccs.neu.edu">samth@ccs.neu.edu</a><br>
</font></blockquote></div><br></div>