efore, 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
e. 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* ...)
(let loop ((cnt n))
for-each,
> > but without the bother of dealing 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
> >
gt; 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
>
> 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 (<= cnt 0)
exp exp*
e 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)
>
efore, 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
ading 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 w