Skip to content

Instantly share code, notes, and snippets.

@narkisr
Created August 28, 2012 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 narkisr/3499929 to your computer and use it in GitHub Desktop.
Save narkisr/3499929 to your computer and use it in GitHub Desktop.
A index selection from a vector in Clojure
(defn index-exclude [r ex]
"Take all indices execpted ex"
(filter #(not (ex %)) (range r)))
(defn dissoc-idx [v & ds]
(map v (index-exclude (count v) (into #{} ds))))
(dissoc-idx [1 2 3] 1 2)
'(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment