Re: Repeat syntax

2017-12-30 Thread Taylan Ulrich Bayırlı/Kammer
else > must have thought of this before, but I couldn't find the equivalent > procedure. After reading 6.10.2 I came up with this > > (define-syntax repeat >   (syntax-rules (repeat) > ((_ n exp exp* ...) >  '(unless (<= n 0) >    exp >    exp* >   

Re: Repeat syntax

2017-11-25 Thread Christopher Howard
on to be happening at run time. The target is to repeat the side effects of the expressions n times, and the return values are irrelevant. I think this last submission from Matt does exactly what I want, the full version being (define-syntax repeat   (syntax-rules () ((_ n exp exp* .

Re: Repeat syntax

2017-11-25 Thread Chris Vine
th a list. It seems like somebody else > must have thought of this before, but I couldn't find the equivalent > procedure. After reading 6.10.2 I came up with this > > (define-syntax repeat >   (syntax-rules (repeat) > ((_ n exp exp* ...) >  '(unless (<= n 0) >    

Re: Repeat syntax

2017-11-25 Thread Matt Wette
> On Nov 25, 2017, at 6:47 AM, Matt Wette wrote: > > you probably want named let > > ((_ n exp exp* ...) > (let loop ((n n)) > (unless (<= n 0) >exp exp* ... >(loop (1- n))) but not a broken one ((_ n exp exp* ...) (let loop ((cnt n)) (unless (<=

Re: Repeat syntax

2017-11-25 Thread Matt Wette
ealing with a list. It seems like somebody else > must have thought of this before, but I couldn't find the equivalent > procedure. After reading 6.10.2 I came up with this > > (define-syntax repeat > (syntax-rules (repeat) > ((_ n exp exp* ...)

Re: Repeat syntax

2017-11-25 Thread Alex Vong
else > must have thought of this before, but I couldn't find the equivalent > procedure. After reading 6.10.2 I came up with this > > (define-syntax repeat >   (syntax-rules (repeat) > ((_ n exp exp* ...) >  '(unless (<= n 0) >    exp >    exp* >   

Repeat syntax

2017-11-24 Thread Christopher Howard
6.10.2 I came up with this (define-syntax repeat   (syntax-rules (repeat) ((_ n exp exp* ...)  '(unless (<= n 0)    exp    exp*    ...    (repeat (- n 1) exp exp* ...) Which doesn't work I think because repeat gets expanded infinitely many times. I was pondering ot