Seven years later, a big thank you from me. I was also being driven crazy 
by this bug. It is insane that this not better documented. In any case it 
should have been fixed by now.

On Thursday, November 22, 2012 at 2:51:03 AM UTC-5, Baishampayan Ghose 
wrote:
>
> Christian,
>
> defmulti has defonce-like semantics which I guess is to prevent the 
> associated defmethods from being wiped out when the form is recompiled.
>
> Cite - 
> https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L1622
>
> -BG
>
>
> On Wed, Nov 21, 2012 at 11:45 PM, Christian Sperandio <
> christian...@gmail.com <javascript:>> wrote:
>
>> Thank you !
>> I became crazy because I didn't see the problem in my code. 
>>
>> Why is there this issue with multi-methods? (and not with standard 
>> functions)
>>
>>
>> Chris
>>
>> Le 22 nov. 2012 à 02:34, grinnbearit <sidhant...@gmail.com <javascript:>> 
>> a écrit :
>>
>> Hi Chris,
>>
>> If you change multimethod arities you'll have to def the multimethod to 
>> nil or restart the swank/nrepl server. It doesn't update that on 
>> recompilation.
>>
>> Sidhant
>>
>> On Thursday, November 22, 2012 3:44:10 AM UTC+5:30, Christian Sperandio 
>> wrote:
>>>
>>> Hi,
>>>
>>> I try to define multi-methods but when I call one I get an exception.
>>>
>>> I declared the multi-methods like below:
>>>
>>> (defmulti new-food-item (fn [food expiration]
>>>                           (if (number? expiration)
>>>                             ::duration
>>>                             ::expiration-date)))
>>>
>>> (defmethod new-food-item ::duration [food expiration-duration]
>>>   (let [expiration-date (GregorianCalendar.)]
>>>     (.add expiration-date GregorianCalendar/DAY_OF_MONTH 
>>> expiration-duration)
>>>     {:name food :expiration-date expiration-date}))
>>>
>>> (defmethod new-food-item ::expiration-date [food expiration-date]
>>>   {:name food :expiration-date expiration-date})
>>>
>>>
>>> And when I do: (new-food-item "tomatoes" 5)
>>> I get this exception:
>>> ArityException Wrong number of args (2) passed to: core$class 
>>>  clojure.lang.AFn.throwArity (AFn.java:437)
>>>
>>> I don't understand where is the problem :/
>>>
>>> Some help?
>>>
>>> Thank you.
>>>
>>> Chris
>>>
>>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clo...@googlegroups.com <javascript:>
>> 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 post to this group, send email to clo...@googlegroups.com 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clo...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>
>
> -- 
> Baishampayan Ghose
> b.ghose at gmail.com
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/a4b3ce99-11e0-4400-9139-a01b49dd9342%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to