Here is an interesting test case that shows that fi we define
(define-syntax-rule (letec-m f) (let/ec c (f c)))
(define                    (letec-f f) (let/ec c (f c)))

we can get two different behaviors with letec-m compiles wrongly.
Obviously a bug!

This is important in casy you would like to make a loop macro effectively
with a continue directive.
(use-modules (ice-9 control))

(define-syntax-rule (letec-m f)
  (let/ec c (f c)))

(define (letec-f f)
  (let/ec c (f c)))

(letec-m (lambda (break) (let lp ((i 0)) (when (< i 2) (pk 1 i) (lp (+ i 1))))))
(letec-f (lambda (break) (let lp ((i 0)) (when (< i 2) (pk 2 i) (lp (+ i 1))))))

#|
OUTPUT:

;;; (2 0)
;;; (2 1)
|#

Reply via email to