I’m using ordered-set for some stuff in Clojure 1.3.0. My project.clj includes [ordered "1.1.0"].
When I call (str (ordered-set 1 2 3)) I get "ordered.set.OrderedSet@6" but when I call a normal clojure hash-set (str (hash-set 1 2 3)) I get the correct "#{1 2 3}" as a result.
The str method calls .toString somewhere, so how do I override the .toString method for ordered-set so I can get a proper string out of it?
thanks
Well, there are two answers to this question. One is, the lazy maintainer of
ordered(me) should get his act together and implementtoString. The other is, you probably shouldn’t be usingstron anything where you care about readability –pr-stris a much more reliable data-presentation function. For example,(str {:a 'a})and(str {:a "a"})both result in"{:a a}". Withpr-strthe type information remains.