I can initialize the list of Int such beautiful way:
[2, 4 .. 20]
And I am just wondering if there is any to initialize the list of my datatype in such manner. Something like this, but using more haskell way:
data SieveElement = SieveElement { index :: Int,
flag :: Bool
} deriving (Show)
prepareSieve start end step
| start > end = []
| otherwise = [SieveElement start True] ++ (prepareSieve (start + step) end step)
let s = prepareSieve 2 20 2
How about using list comprehensions: