fork download
  1. a = [1..50]
  2. b = [1..]
  3.  
  4. each _ [] = []
  5. each n (x:xs) = x: (each n $ drop (n - 1) xs)
  6.  
  7. main = do
  8. print $ each 4 a
  9. print $ take 10 $ each 4 b
Success #stdin #stdout 0.02s 3592KB
stdin
Standard input is empty
stdout
[1,5,9,13,17,21,25,29,33,37,41,45,49]
[1,5,9,13,17,21,25,29,33,37]