I don't quite understand how seq exactly works and how to implement a function using seq. So as an exercise, if I want to implement a function that generates a list starting with a number a.
for example, I'm using the following function
countup n = n : countup (n+1)
and trying to get [1, 2, 3, 4 ...] (starting from 1, just increment 1 and add to the list) as an infinite lazy list. How should I do this?
UPDATED:
I'm trying to make (take k (countup 0)) to use O(1) space. Here, take function is as follows:
take k (x:xl) =
if k==0
then x
else take (k-1) xl