Skip to content

Instantly share code, notes, and snippets.

@dionyziz
Created April 28, 2019 21:46
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 dionyziz/7cda349aaaf307751b3f3d1d3019eda5 to your computer and use it in GitHub Desktop.
Save dionyziz/7cda349aaaf307751b3f3d1d3019eda5 to your computer and use it in GitHub Desktop.
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