guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loop macros (was: Re: macro definition for continue and break)


From: Damien Mattei
Subject: Re: Loop macros (was: Re: macro definition for continue and break)
Date: Wed, 14 Sep 2022 17:56:14 +0200

thank you, i had a look directly on the web site, but since a few days i'm
just using a single 'repeat ... until macro of my own (directly inspired
from Pascal :-) if i do not mistake... and where i can put local define or
just make mutations.

;; scheme@(guile-user)> {i <+ 5}
;; scheme@(guile-user)> (repeat (display i) (newline) {i <- {i - 1}} until
{i < 0})
;; 5
;; 4
;; 3
;; 2
;; 1
;; 0

(define-syntax repeat
  (syntax-rules (until)
    ((repeat b1 ...
       until pred)
     (let loop () b1 ... (when (not pred) (loop))))))


regards,
damien

On Tue, Sep 13, 2022 at 4:28 PM Maxime Devos <maximedevos@telenet.be> wrote:

>
>
> On 13-09-2022 16:25, Damien Mattei wrote:
> > do you have any examples of use? that illustrate the features ,just with
> > the code it is not easy.
>
> "git grep -F let^" inside the repo.  More specifically, parse-expandable
> from (gnu gnunet config parser), though there are other uses too.
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]