Skip to content

Instantly share code, notes, and snippets.

@merijn
Created June 12, 2015 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merijn/3f9ce423edadf1622823 to your computer and use it in GitHub Desktop.
Save merijn/3f9ce423edadf1622823 to your computer and use it in GitHub Desktop.
dropAt
dropAt :: Int -> [a] -> [a]
dropAt = go id
where
go :: ([b] -> [b]) -> Int -> [b] -> [b]
go f n [] = f []
go f 0 (x:xs) = f xs
go f n (x:xs) = go (f . (x:)) (n-1) xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment