More specifically, how do I generate a new list of every Nth element from an existing infinite list?
E.g. if the list is [5, 3, 0, 1, 8, 0, 3, 4, 0, 93, 211, 0
[5, 3, 0, 1, 8, 0, 3, 4, 0, 93, 211, 0
Old question but I'll post what I came up with:
everyNth :: [a] -> Int -> [a] everyNth xs n = [snd x | x <- (zip [1..] xs), fst x `mod` n == 0]
I put the list argument before the Int so I can curry the function and a list then map that over a list of Ints if ever I need to.
Int