aboutsummaryrefslogtreecommitdiff
path: root/algebraic-structures.private.stream.scm
diff options
context:
space:
mode:
Diffstat (limited to 'algebraic-structures.private.stream.scm')
-rw-r--r--algebraic-structures.private.stream.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/algebraic-structures.private.stream.scm b/algebraic-structures.private.stream.scm
new file mode 100644
index 0000000..a268841
--- /dev/null
+++ b/algebraic-structures.private.stream.scm
@@ -0,0 +1,20 @@
+(module (algebraic-structures private stream) (<> unit fold reduce map1)
+ (import scheme
+ (srfi 41)
+ (streams utils)
+ (only (chicken base) assert))
+
+ (define (<> xs ys) (stream-append xs ys))
+
+ (define unit stream-null)
+
+ (define (fold f init xs)
+ (stream-fold (lambda (x acc) (f acc x))
+ init
+ xs))
+
+ (define (reduce f xs)
+ (stream-fold-one f xs))
+
+ (define (map1 f xs)
+ (stream-map f xs)))