So, been going over some old exams in preparation for my upcoming one and came across this question:
Write Haskell code to define ints :: [Int]
an infinite list of the following form:
[0, 1, -1, 2, -2, 3, -3, 4, -4..]
I've been plugging at it for the past half an hour but can't seem to find anything to solve it or that will do what I want. I get the feeling that what I am really wanting is a list comprehension of the form
ints :: [Int]
ints = [0] ++ [x (-x) | x <- [1..]]
But this doesn't work and I'm unsure of how to get it to work