unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* for with break and continue
@ 2022-09-04  9:54 Damien Mattei
  2022-09-04 10:43 ` Jean Abou Samra
  0 siblings, 1 reply; 7+ messages in thread
From: Damien Mattei @ 2022-09-04  9:54 UTC (permalink / raw)
  To: guile-user

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-09-05  8:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-04  9:54 for with break and continue Damien Mattei
2022-09-04 10:43 ` 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

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).