a = [1..50]b = [1..] each _ [] = []each n (x:xs) = x: (each n $ drop (n - 1) xs) main = do print $ each 4 a print $ take 10 $ each 4 b
Standard input is empty
[1,5,9,13,17,21,25,29,33,37,41,45,49] [1,5,9,13,17,21,25,29,33,37]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!