guile-user
[Top][All Lists]
Advanced

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

macro definition for continue and break


From: Damien Mattei
Subject: macro definition for continue and break
Date: Sun, 4 Sep 2022 10:19:14 +0200

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


reply via email to

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