Disoc doesn't make much sense for vectors for two reasons:
- A
dissoc value means "delete key." You cannot remove a key from a vector without causing other side effects (for example, moving all future values). dissoc will perform relatively poorly on vectors if it had to move all subsequent keys - roughly O (n) with a fairly large amount of GC. The Clojure core usually avoids performing operations that are inefficient / meaningless for a particular data structure.
Basically, if you want to make dissoc on a vector, you are probably using the wrong data structure. The likely choice of a hash map or set is the best choice.
If you need a data structure that works like a vector, but supports cutting and pasting elements or subsequences, then you should check the RRB trees: https://github.com/clojure/core.rrb-vector
source share