blob: ac67e0c51b0218582b6008c9ca84c7d2b9292b62 (
about) (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
(module (algebraic-structures private stream applicative) ()
(import scheme
(srfi 41)
(only (chicken base) cute)
(chicken module)
(only (algebraic-structures stream functor)))
(export pure map2)
(reexport (algebraic-structures stream functor))
(define (pure x) (stream x))
(define-stream (product op s1 s2)
(if (stream-null? s1)
stream-null
(stream-append (stream-map (cute op (stream-car s1) <>) s2)
(product op (stream-cdr s1) s2))))
(define map2 product))
|