21
21
------------------------------------------------------------------------
30
30
map : ∀ {A B} → (A → B) → Stream A → Stream B
31
31
map f (x ∷ xs) = f x ∷ ♯ map f (♭ xs)
35
35
zipWith _∙_ (x ∷ xs) (y ∷ ys) = (x ∙ y) ∷ ♯ zipWith _∙_ (♭ xs) (♭ ys)
37
37
take : ∀ {A} (n : ℕ) → Stream A → Vec A n
39
39
take (suc n) (x ∷ xs) = x ∷ take n (♭ xs)
43
43
drop (suc n) (x ∷ xs) = drop n (♭ xs)
46
46
repeat x = x ∷ ♯ repeat x
48
48
iterate : ∀ {A} → (A → A) → A → Stream A