Created
April 28, 2019 21:46
-
-
Save dionyziz/7cda349aaaf307751b3f3d1d3019eda5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RemoveAt where | |
removeAt :: Int -> [a] -> (a, [a]) | |
removeAt n xs = (item, list) | |
where item = xs!!(n - 1) | |
list = map snd (filter fst (zip characteristic xs)) | |
characteristic = before ++ pivot ++ after | |
before = replicate (n - 1) True | |
pivot = [False] | |
after = repeat True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment