[racket] does anyone have an example of a closure cycle in zo-parse?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Sun May 8 18:50:06 EDT 2011

In Racket 5.1.1's compiler/zo-parse module, I see that the
documentation on the 'closure' structure says that there can be cycles
due to recursive closure calling.  I can see this, but I haven't been
able to figure out why there would be different instances of closures
with different gen-ids.  Does anyone have an example of one?

Here's the code I'm using to play with 5.1.1's compiler/zo-parse module.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#lang racket/base
(require compiler/zo-parse
            (for-syntax racket/base))

(define (run-zo-parse stx)
  (parameterize ([current-namespace (make-base-namespace)])
    (let ([bc (compile stx)]
          [op (open-output-bytes)])
      (write bc op)
      (zo-parse (open-input-bytes (get-output-bytes op))))))

;; A cyclic structure should show here:
(run-zo-parse #'(letrec ([g (lambda () (g))]) (g)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Posted on the users mailing list.