2013-10-17 54 views
4
錯誤

我學習協議Clojure中,我碰到這個錯誤來抓下面的代碼:defprotocol「沒有單一的方法」的錯誤似乎是在Leiningen

直到我試圖

CompilerException java.lang.IllegalArgumentException: No single method: valores_BANG_ of interface: gangnam.core.Legi found for function: valores! of protocol: Legi, compiling:(NO_SOURCE_PATH:1:1)

一切都是美妙的工作向協議添加七個+方法(下面的valores!)。所以我將valores複製到valores!中,以確保我使用相同的代碼,除了最後的!,它不起作用。我也嘗試換一個不同的名字(dele)。

然後我想起來,我最近跑lein install,當我再次運行lein install,似乎解決了這個問題。任何想法爲什麼這可能會發生?

(defprotocol Legi 
    (lege [self] [self key]) 
    (carpe! [self] [self key] [self key val]) 
    (muta!* [self key val]) 
    (juga! [from label to]) 
    (claves [self]) 
    (valores [self]) 
    (valores! [self])) 

(extend-protocol Legi 
    Iterable 
    (lege 
    ([self] 
     (for [elm self] 
     (lege elm))) 
    ([self key] 
     (for [elm self] 
     (lege elm key)))) 
    (carpe! 
    ([self] 
     (for [elm self] 
     (carpe! elm))) 
    ([self key] 
     (for [elm self] 
     (carpe! elm key))) 
    ([self key val] 
     (for [elm self] 
     (carpe! elm key val)))) 
    (muta!* 
    [self key val] 
    (doall (for [elm self] 
     (muta!* elm key val)))) 
    (juga! [from label to] 
    (for [elm from] 
     (juga! elm label to))) 
    (claves [self] 
    (for [elm self] 
     (claves elm))) 
    (valores [self] 
    (for [elm self] 
     (valores elm))) 
    (valores! [self] 
    (for [elm self] 
     (valores elm))) 
    Element 
    (lege 
    ([self] 
     (into {} (for [k (.getPropertyKeys self)] 
       [(keyword k) (lege self k)]))) 
    ([self key] 
     (-> self (.getProperty (name key))))) 
    (carpe! 
    ([self] 
     (for [k (.getPropertyKeys self)] 
     (carpe! self k))) 
    ([self key] 
     (let [prop (lege self key)] 
     (res 
      (-> self (.removeProperty (name key)))) 
     prop)) 
    ([self key val] 
     (let [prop (lege self key)] 
     (if (= val prop) 
      (carpe! self key))))) 
    (muta!* [self key val] 
    (res 
     (let [key (name key)] 
     (.setProperty self key val) 
     self))) 
    (juga! [from label to] 
    (when (and from to) 
     (res 
     (.addEdge *g* 
      nil from to (name label))))) 
    (claves [self] 
    (-> self .getPropertyKeys)) 
    (valores [self] 
    (-> self lege vals)) 
    (valores! [self] 
    (-> self lege vals))) 
+2

我不能告訴你這花費了多少時間,直到我知道是什麼原因造成的! –

回答

2

lein clean應該爲你解決這個問題。

相關問題