Created
February 6, 2012 10:57
-
-
Save ijp/1751461 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; will work for any sufficiently lazy functor ;-) | |
(letrec ((loeb (lambda (stream) | |
(define (%loeb stream) | |
(delay | |
(stream-map (lambda (func) | |
(func (force (%loeb stream)))) | |
stream))) | |
(force (%loeb stream)))) | |
(s (stream stream-length | |
stream-car | |
(cut stream-ref <> 3) | |
(cut stream-ref <> 1)))) | |
(stream->list (loeb s))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment