4 ms·
how does FREQUENCIES know how to compare strings? In Common Lisp you'd usually supply a TEST keyword parameter (#'STRING= or #'EQUAL in this case). Does Clojur
by mrottenkolber 13y ago
how does FREQUENCIES know how to compare strings?
In Common Lisp you'd usually supply a TEST keyword parameter (#'STRING= or #'EQUAL in this case). Does Clojure use Java's type system to infer?
- GregWright 13y agoNo expert, but from the source it looks like it just uses whatever a 'map' uses to match keys: (defn frequencies "Returns a map from distinct items in coll to the number of times they appear." {:added "1.2" :static true} [coll] (persistent! (reduce (fn [counts x] (assoc! counts x (inc (get counts x 0)))) (transient {}) coll)))
- deleted 13y ago[deleted]
- prospero 13y agohttp://docs.oracle.com/javase/6/docs/api/java/lang/Object.html#equals(java.lang.Object) http://docs.oracle.com/javase/6/docs/api/java/lang/Object.ht...
- nickik 13y agoClojure uses a unified compare test, sometimes called equiv. I think its passed on this paper, http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.9999 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.9...