So I have some code that looks somewhat like: (update-in node [:index :x] set/union #{:y})
This seems fine as long as there's already a set in the desired spot. However, since update-in will kindly build the map structure for you if it doesn't already exist, I figured it would be nice not to have to check for nils and replace them with empty sets. So I tried this: => (set/union nil #{:foo}) (:foo) Huh? I checked its class, and it is indeed a list. So I tried: => (set/union '(1 2 3 a) '(a b c)) (c b a 1 2 3 a) => (set/union [0 1 2 3] [0]) [0 1 2 3 0] Looking at the source explains this: (defn union "Returns a set that is the union of the two sets." [xset yset] (reduce conj xset yset)) I don't know if this (and any similar weirdness in the rest of the set namespace) should be fixed since you aren't really supposed to throw non-sets in there, but I do think a special case for nil might be nice here. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---