viewing paste delay-test.scm | Scheme

Posted on the
1 2 3 4 5 6 7
(write (letrec ((a-stream
                               (letrec ((next (lambda (n)
                                                (cons n (delay (next (+ n 1)))))))
                                 (next 0)))
                              (head car)
                              (tail (lambda (stream) (force (cdr stream)))))
                       (head (tail (tail a-stream)))))
Viewed 618 times, submitted by Guest.