From e51a5f32bb8f23eb0fd27213cb36ce09a42a6386 Mon Sep 17 00:00:00 2001 From: Masaya Tojo Date: Sun, 16 Jun 2024 12:15:11 +0900 Subject: Add stream implementations --- algebraic-structures.private.stream.monad.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 algebraic-structures.private.stream.monad.scm (limited to 'algebraic-structures.private.stream.monad.scm') 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))) -- cgit v1.2.3