Hi all. In Stuart's book - Programming Clojure, there is a multi
method like following:

(defmulti blank? class)
(defmethod blank? String [s] (every? #{\space} s))
(defmethod blank? nil [_] true)

After reading the method, I was curious about type or class of native
data structures of Clojure. So I typed next code in slime. Hmm.. I
didn't understand why classes of {:a 1} and {} are not same. Like
Stuart's code, to make multi method branching based on clojure data
structure type(map, vector, list), what symbol should I use? (Like
String for "string", Is there a Map for {:a 1}? I tried
PersistentHashMap, HashMap, Map, so on.. I didn't find it.)

user> (= (class "abc") String)
true
user> (class {:a 1 :b 2})
#=clojure.lang.PersistentHashMap
user> (class {})
#=clojure.lang.PersistentHashMap
user> (= (class {:a 1}) (class {}))
false
user> (= (class {:a 1}) (class {:b 2}))
true
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to