Hi everyone, 

I have the following question regarding the defmultis of clojure: 

(defmulti create-fact
  (fn [item-vector] (do
                      (print item-vector)
                      (first item-vector))))

(defmethod create-fact [:a] [item-vector]
  (str "a"))

(defmethod create-fact [[:a "safs"]] [item-vector]
  (str "safs"))


(mapv create-fact {:a "safs"})


Dispatch function is not called in this case and return is "safs" so the 
matching key is [[:a "safs"]]. I except it to be :a, why is that [[:a 
"safs"]]?

Thanks for your help!

Regards,

Timur

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to