Filter out elements at odd positions

Assos 2018-03-07 15:38:20.223521 UTC

1filterOdd :: Integral a1 => a1 -> [a2] -> [a2]
2filterOdd _ [] = []
3filterOdd pos (hd:tl) = if (mod pos 2) == 0
4 then hd : filterOdd (pos + 1) tl
5 else filterOdd (pos + 1) tl
6
7f :: [Int] -> [Int]
8f lst = filterOdd 1 lst -- Fill up this Function
9
10-- This part deals with the Input and Output and can be used as it is. Do not modify it.
11main = do
12 inputdata <- getContents
13 mapM_ (putStrLn. show). f. map read. lines $ inputdata