aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structures.private.stream.monad.scm
diff options
context:
space:
mode:
authorMasaya Tojo <masaya@tojo.tokyo>2024-06-16 12:15:11 +0900
committerMasaya Tojo <masaya@tojo.tokyo>2024-06-16 12:15:11 +0900
commite51a5f32bb8f23eb0fd27213cb36ce09a42a6386 (patch)
tree3c4d043a91d56fff6e7d59e3ed829dbeee0dbe26 /algebraic-structures.private.stream.monad.scm
parenta0ed10aa2a780894c8f63bd4bde218d56eba411e (diff)
Add stream implementations
Diffstat (limited to 'algebraic-structures.private.stream.monad.scm')
-rw-r--r--algebraic-structures.private.stream.monad.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/algebraic-structures.private.stream.monad.scm b/algebraic-structures.private.stream.monad.scm
new file mode 100644
index 0000000..e22a396
--- /dev/null
+++ b/algebraic-structures.private.stream.monad.scm
@@ -0,0 +1,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)))