Clojure是否在defprotocol中支持多arar / variadic函数?

时间:2018-06-27 16:00:53

标签: clojure

这是我的协议:

(defprotocol IGetK
  (get-k [this & ks]))

(deftype SAtom []
  IGetK
  (get-k [this & ks]
    {:satom this :keys (vec ks)}))

(get-k (SAtom.) :a)

出现此错误:

CompilerException java.lang.IllegalArgumentException: No single method: get_k of interface: user.IGetK found for function: get-k of protocol: IGetK, compiling:(/private/var/folders/_n/1938yrr56g7bwhsk337w9qvw0000gn/T/form-init2301096807799007190.clj:1:1) 

0 个答案:

没有答案