I want to write a fstEven function that checks if the even-indexed integers in a list are all even; since in Haskell lists are have zero-based indexing, an even index corresponds to an odd position, and therefore an example of correct outputs would be
> fstEven [2,0,2,0]
True
> fstEven [1,2,3,4]
False
My attempt is this:
fstEven :: [Int] -> Bool
fstEven [] = False
fstEven (x:_:xs)
| x `mod` 2 == 0 = True
| otherwise = fstEven xs
But it seems to always give true as long as the last even position in the list is even, regardless of the others.