aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structures.private.stream.monad.scm
blob: e22a396d009c36f1a279c80369ddf08790a95777 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
(module (algebraic-structures private stream monad) (>>=)
  (import (except scheme map apply)
          (chicken module)
          (srfi 41))
  (reexport (algebraic-structures stream applicative))

  (define-stream (stream-append-map f strm)
    (if (stream-null? strm)
        stream-null
        (stream-append (f (stream-car strm))
                       (stream-append-map f (stream-cdr strm)))))

  (define (>>= xs f)
    (stream-append-map f xs)))