Skip to content

Instantly share code, notes, and snippets.

@jeapostrophe
Created July 29, 2010 16:02
Show Gist options
  • Save jeapostrophe/498511 to your computer and use it in GitHub Desktop.
Save jeapostrophe/498511 to your computer and use it in GitHub Desktop.
(define (apply-reduction-relation/generator red t visited?)
(generator
()
(let loop ([t t])
(unless (visited? t)
(let ([tps (apply-reduction-relation red t)])
(if (empty? tps)
(yield t)
(for-each loop tps)))))
(yield #f)))
(define (make-hash-visited?)
(define ht (make-hash))
(λ (t)
(if (hash-has-key? ht t)
#t
(begin0 #f
(hash-set! ht t #t)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment