[plt-scheme] for.ss

From: David Einstein (deinst at gmail.com)
Date: Sat Sep 22 14:01:33 EDT 2007

On 9/20/07, Jens Axel Søgaard <jensaxel at soegaard.net> wrote:
Sorry for annoying everybody yet again, but I think I

> Do you have an example of the intended behaviour?

The following seems to work some of the time

(require (planet "42.ss" ("soegaard" "srfi.plt" 2 1)))
(define-generator (:nested stx)
  (syntax-case stx ()
    [(:nested (var ...) gen ...)
     (with-syntax ([(tmp ...) (generate-temporaries #'(var ...))])
       #'(:do (let-values ([(fun-in done-in tmp ...)
                            (let/cc ret
                              (do-ec gen ... (let/cc enter
(call-with-values (lambda () (values enter #f var ...)) ret)))
                              (call-with-values (lambda () (values #f
#t var ...)) ret))]))
              ((fun fun-in)(done done-in)(var tmp) ...)
              (not done)
              (let ())
              #t
              ((fun))))]))

(list-ec (:while (:nested (a b) (: a 1 10) (: b 1 10) (if (= 1 (gcd a
b)))) (< (* a b) 50)) (list a b))

works, but

(list-ec (:while (:nested (a b) (: a 1 10) (: b 1 10) (if (= 1 (gcd a
b)))) #t) (list a b))

does not (it gives an "reference to undefined identifier: a" error).

I'm going to break out the macro expander to see what is going on.


Posted on the users mailing list.