[racket] FOR loop

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon May 5 00:51:44 EDT 2014

If you need to introduce "variable" like that then, you need define 
"for" as special syntax (perhaps using "define-syntax" and 
"syntax-case"), not define "for" as a procedure.

Or, if you want to define "for" as a procedure, then there should be no 
"variable" argument, and the "body" argument should be a procedure that 
accepts one argument.  Then, you make the "for" procedure apply the 
"body" procedure on each iteration, giving "body" the value of the loop 
counter as its argument.

Neil V.


Posted on the users mailing list.