给定 Clojure 中的集合、映射和向量同时实现 IPersistentCollection 和 IFn,Clojure 如何决定使用哪个 SayHi 实现:
(defprotocol SayHi
  (hi [this]))
(extend-protocol SayHi
  clojure.lang.IPersistentCollection
  (hi [_] (println "Hi from collection"))
  clojure.lang.IFn
  (hi [_] (println "Hi from Fn!"))
  clojure.lang.IPersistentSet
  (hi [_] (println "Hi from set!")))
(hi #{})
Hi from set!
(hi [])
Hi from collection