data Stream = Str (Integer, Stream)

map_stream :: (Integer -> Integer) -> Stream -> Stream
map_stream f (Str (n, s)) = Str (f n, map_stream f s)

konst :: Integer -> Stream
konst x = Str (x, konst x)

chuchu :: Integer -> Stream
chuchu n = Str (n, chuchu (n + 1))

-- Prvih n elementov toka pretvori v seznam
to_list :: Integer -> Stream -> [Integer]
to_list 0 _ = []
to_list n (Str (x, s)) = x : (to_list (n-1) s)

fibonacci :: [Integer]
fibonacci = 0 : 1 : (zipWith (+) fibonacci (tail fibonacci))
