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.godiw...@gmail.com> 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 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 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