<div><font face="courier new,monospace">There's something quite basic about how scheme works that eludes me. Please let me know if it would be more appropriate to post this somewhere eles.</font></div>
<div><font face="courier new,monospace"> </font></div>
<div><font face="courier new,monospace">This program works as I expect:</font></div>
<div><font face="courier new,monospace"> </font></div>
<div><font face="courier new,monospace">(let loop ((a 0))</font></div>
<div><font face="courier new,monospace"> (if (> a 3)</font></div>
<div><font face="courier new,monospace"> (print "it's over")</font></div>
<div><font face="courier new,monospace"> (begin (print a)</font></div>
<div><font face="courier new,monospace"> (loop (+ 1 a)))))</font></div>
<div><font face="courier new,monospace"> </font></div>
<div><font face="Courier New">If add an extra set of parentheses around the begin clause:<br><br>(let loop ((a 0))<br> (if (> a 3)<br> (print "it's over")<br> (begin ((print a)<br> (loop (+ 1 a))))))</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">I get the following (from DrRacket 5.3.1) :</font></div>
<div><font face="courier new,monospace">0123"it's over". . application: not a procedure;<br> expected a procedure that can be applied to arguments<br> given: #<void><br> arguments...:<br> #<void></font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">I don't understand how adding the extra parentheses caused the change in behavior.</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Thanks,<br>Jan Erik</font></div>