Skip to content

Instantly share code, notes, and snippets.

@dschobel
Created February 24, 2013 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dschobel/5024821 to your computer and use it in GitHub Desktop.
Save dschobel/5024821 to your computer and use it in GitHub Desktop.
streams in scheme
(define (stream-maker seed fx)
(letrec ([f (lambda(x) (cons x (lambda () (fx x))))])
(lambda () (f seed))))
(define naturals (stream-maker 1 (lambda (x) (+ x 1))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment