From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: for with break and continue
Date: Sun, 4 Sep 2022 11:54:00 +0200 [thread overview]
Message-ID: <CADEOadf3qBUbRgC4W1YDKFRWhFhR52vg5f2ZUh5Vqv-TfeehcA@mail.gmail.com> (raw)
i try to make a for with break and continue the way C language do it, i
works with break but if i add a continue feature i then loose the break
feature, here is my code:
(define-syntax for/bc
(lambda (stx)
(syntax-case stx ()
((kwd (init test incrmt) body ...)
(with-syntax
((BREAK (datum->syntax #'kwd 'break)))
#'(call/cc
(lambda (escape)
(let-syntax
((BREAK (identifier-syntax (escape))))
init
(let loop ()
(when test
(with-syntax
((CONTINUE (datum->syntax #'kwd 'continue)))
#'(call/cc
(lambda (next)
(let-syntax
((CONTINUE (identifier-syntax (next))))
body ...)))
incrmt
(loop))))))))))))
Damien
next reply other threads:[~2022-09-04 9:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-04 9:54 Damien Mattei [this message]
2022-09-04 10:43 ` for with break and continue Jean Abou Samra
2022-09-04 12:00 ` Damien Mattei
2022-09-04 12:40 ` Jean Abou Samra
2022-09-04 14:41 ` Damien Mattei
2022-09-05 0:42 ` Jean Abou Samra
2022-09-05 8:46 ` Damien Mattei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEOadf3qBUbRgC4W1YDKFRWhFhR52vg5f2ZUh5Vqv-TfeehcA@mail.gmail.com \
--to=damien.mattei@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).