Just to give an answer to Arthur: conj is defined even earlier (the conj name appears on line 82 of the .clj vs .1443 kernel for disj and 1429 for dissoc ) and still works on all types of the Clojure collection. :-) Obviously, it does not use protocols - instead, it uses the usual Java interface, like most Clojure functions (in fact, I believe that at present the only part of the βcoreβ functionality in Clojure that uses protocols is reduce / reduce-kv ).
I would suggest that this is because of the aesthetic choice and is probably related to how the cards support conj , whether they should support disj , we can expect him to accept the same arguments that could be switched to conj , which would be problematic:
;; hypothetical disj on map (disj {:foo 1 [:foo 1] 2 {:foo 1 [:foo 1] 2} 3} } {:foo 1 [:foo 1] 2} ;; [:foo 1] similarly problematic )
Should they return {} , {:foo 1 [:foo 1] 2} or {{:foo 1 [:foo 1] 2} 3} ? conj happily accepts [:foo 1] or {:foo 1 [:foo 1] 2} as things conj on the map. ( conj with two map arguments means merge , indeed merge is implemented in conj terms, adding special nil processing).
Therefore, it may make sense to have a dissoc for the cards so that it clears that it removes the key, rather than "what could be conj " d ".
Now, theoretically, dissoc could work on sets, but then perhaps one would expect them to support assoc , which might not make sense. It might be worth noting that vectors support assoc , not dissoc , so they don't always go together; there, of course, there is some kind of aesthetic tension.
source share