Skip to content

Instantly share code, notes, and snippets.

@ndonolli
Created April 3, 2019 16:24
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 ndonolli/56426320e9e815f101555fc9eb9737c2 to your computer and use it in GitHub Desktop.
Save ndonolli/56426320e9e815f101555fc9eb9737c2 to your computer and use it in GitHub Desktop.
Remove nth element from a list or vector
(defn remove-at [n xs]
(let [removed (flatten (conj (drop (+ n 1) xs)(take n xs)))]
(if (vector? xs)
(vec removed)
removed)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment