Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(define ones (stream-cons 1 ones)) ;<---has not evalutated ones yet, as ones is a stream
(stream-ref ones 1) ;-->1
(stream-ref ones 10) ;-->1
(stream-ref ones 37) ;-->1 (an infinite stream of ones)
(define integers (stream-cons 1 (add-streams ones integers))); <--counts up from 1
(define fibonacci (stream-cons 0 (stream-cons 1 (add-streams (stream-rest fibonacci) fibonacci)))) ; <--Displays fibonacci numbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.