Why doesn't the clojure set accept a default argument?

Why do cards and keywords have extra arity with a default argument, but no sets?

Is this an implementation detail or a specific design decision?

({:a 2} :b :not-found) ;;=> :not-found (:b {:a 2} :not-found) ;;=> :not-found ;; This seems counter intuitive. (#{:a} :b :not-found) ;;=> clojure.lang.ArityException (:b #{:a} :not-found) ;;=> :not-found 
+6
source share
1 answer

I don’t think there is any good reason: they certainly could, and this seems reasonable enough to me. This feature was added for maps and keywords in 3b7c1612 and has not been affected since; I assume that this simply was not included in this initial commit, and there was not much reason to reconsider this decision since then.

+3
source

All Articles