cyclone/examples/tail-call-optimization.scm
2015-02-21 22:15:18 -05:00

11 lines
235 B
Scheme

;; This should run forever using a constant amount of memory
;; and max CPU:
;; Original program:
;; (define (foo) (bar))
;; (define (bar) (foo))
;; (foo)
(letrec ((foo (lambda () (bar)))
(bar (lambda () (foo))))
(foo))