[racket] novice question about parentheses and control flow

From: je back (jeback1 at gmail.com)
Date: Wed Dec 12 10:25:56 EST 2012

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.

This program works as I expect:

(let loop ((a  0))
  (if (> a 3)
      (print "it's over")
      (begin (print a)
             (loop (+ 1 a)))))

If add an extra set of parentheses around the begin clause:

(let loop ((a  0))
  (if (> a 3)
      (print "it's over")
      (begin ((print a)
             (loop (+ 1 a))))))

I get the following (from DrRacket 5.3.1) :
0123"it's over". . application: not a procedure;
 expected a procedure that can be applied to arguments
  given: #<void>
  arguments...:
   #<void>

I don't understand how adding the extra parentheses caused the change in
behavior.

Thanks,
Jan Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121212/4d02100b/attachment.html>

Posted on the users mailing list.