> And the namespace is completely riddled with bugs. union returns duplicates if some of the inputs are lists instead of sets depending on their length. to be clear I assume he is taking about this: ``` try-spec.core=> (clojure.set/union [1,2] [1,2]) [1 2 1 2] ``` Though im not sure what "depending on their length means". > for the above bugs there are two possible fixes: raise an IllegalArgumentException if anything…
I'm a bit confused by your example. Python has different design goals than Clojure. Clojure competes with rather high performance languages, Java and Scala, on the JVM and it appears from the OP that its implementors have decided that it can't afford to spend too much time at run-time checking. Python on the other hand at least attempts to adhere to a principle of least surprise and enforces strong type requirements…
I think pythons resolutes only seem less surprising because someone would be used to them? Maybe that coercion is easier to reason about. Im honestly not sure. Like this example:
In [19]: s = set([1, 2, 3])
In [20]: s.union({"x", "y"})
Out[20]: {1, 2, 3, 'y', 'x'}
Is that more clear then explicitly requiring only sets be unioned?Why the key and the value? The meaning of the key and value have been drastically change now. Maybe this is what all languages do?
anyway, I think i gained a lot thinking this through. Thanks everyone :)
*One error Is I mistakenly said that strings weren't hashable.