Created
August 28, 2012 16:24
-
-
Save narkisr/3499929 to your computer and use it in GitHub Desktop.
A index selection from a vector in Clojure
This file contains hidden or 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
(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