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

my previous question ,clearly more, is :
(define-syntax for/bc

  (syntax-rules (continue break)

    ((_ (init test incrmt) b1 ...)

     (call/cc (lambda (break)
(let ()
 init
 (let loop ()
   (when test
 (call/cc (lambda (continue) b1 ...))
 incrmt
 (loop)))))))))

is there a way to make working this macro in a R6RS compatible way (i know
it is possible in Racket or with syntax features...)

to avoid error:
(for/bc ({i <+ 0} {i < 5} {i <- {i + 1}})
  {x <+ 7}
 (display x)
 (newline)
 (break))

;;; <stdin>:2:73: warning: possibly wrong number of arguments to `break'
7
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong number of arguments to #<procedure break (pred clist)>

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

Damien


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

end of thread, other threads:[~2022-09-14 15:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-04  8:19 macro definition for continue and break Damien Mattei
2022-09-04 10:08 ` Jean Abou Samra
     [not found]   ` <CADEOadd2OAL-Z4o9AAR_mQ5_NSjCA1tVz5cDgeufVZ=ocAx0vQ@mail.gmail.com>
2022-09-04 11:13     ` Jean Abou Samra
2022-09-12 19:19       ` Linus Björnstam
2022-09-12 20:57         ` Loop macros (was: Re: macro definition for continue and break) Maxime Devos
2022-09-12 21:09           ` Linus Björnstam
2022-09-13 14:25           ` Damien Mattei
2022-09-13 14:28             ` Maxime Devos
2022-09-14 15:56               ` Damien Mattei
2022-09-13 14:16         ` macro definition for continue and break 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).