Skip to content

Instantly share code, notes, and snippets.

@Rydgel
Last active August 29, 2015 14:06
Show Gist options
  • Save Rydgel/9c9ce1eced0ab4015e23 to your computer and use it in GitHub Desktop.
Save Rydgel/9c9ce1eced0ab4015e23 to your computer and use it in GitHub Desktop.
module Golf where
skips :: [a] -> [[a]]
skips xs = map (\(i,x) -> takeNth i x) $ zipWith (\_ b -> (b, xs)) xs [1..]
takeNth :: Int -> [a] -> [a]
takeNth n xs = [y | (i,y) <- zip [1..] xs, i `mod` n == 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment