cyclone/examples/tail-call-optimization.scm
2016-04-13 21:53:06 -04:00

11 lines
242 B
Scheme

;; This should run forever using a constant amount of memory
;; and max CPU:
(define (foo) (bar))
(define (bar) (foo))
(foo)
;; Another way to write it:
;; (letrec ((foo (lambda () (bar)))
;; (bar (lambda () (foo))))
;; (foo))