Dear list,<div><br></div><div>I was a bit tired of writing "for" loops for a single variable when I didn't need the variable just to do something a few times. In that case Scheme's "for" seems needlessly verbose. I'm also not that into recursion in that case. So; I was missing ChucK's "repeat(n) { body }", which simply executes "body" n times. Few people seem to use that in ChucK, but I blame that on it being under-documented and non-traditional, not on a lack of usefulness.</div>
<div><br></div><div>So; I did this and added it to my .fluxus.scm;</div><div><br></div><div><div>(define-syntax-rule (repeat n f ...)</div><div>    (for ((x (in-range 0 n))) f ... ))</div><div><br></div><div>While I was at it I also did this, which may or may not be good for anything;</div>
<div><br></div><div>(define-syntax-rule (repeat/list n f ...)</div><div>    (for/list ((x (in-range 0 n))) f ... ))</div></div><div><br></div><div>usage example;</div><div><br></div><div>;build 20 cubes</div><div>(repeat 20</div>
<div>  (translate (vector 2 0 0))</div><div>  (colour (rndvec))</div><div>  (build-cube))</div><div><br></div><div>Hope that's useful to some.</div><div><br></div><div>Yours,</div><div>Kas.</div>