;; (FIB) generates the Fibonacci sequence and emits sequential (index . element) pairs. !(set-env (letrec ((next (lambda (a b n) (next b ;; We are using IF as a poor-man's PROGN. ;; The condition is evaluated first, then one of the branches is evaluated. (+ (if (emit (cons n a)) a a) b) (+ 1 n)))) (fib (lambda () (next 0 1 0)))) (current-env)))