Dennis Haupt <d.haup...@gmail.com> writes: > i am not trying anything, i just want to figure out what happens. this is my > output for the "print" version: > user=> (defmulti fac print) > (defmethod fac 1 [_] 1) > (defmethod fac :default [n] (*' n (fac (dec n)))) > #'user/fac > #<MultiFn clojure.lang.MultiFn@1afb02d> > #<MultiFn clojure.lang.MultiFn@1afb02d> > user=> (fac 1) > 10-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-....until > stackoverflow
Since print produces nil for a dispatch value, and nil is not 1, it always calls your :default method. -- -- 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. For more options, visit https://groups.google.com/groups/opt_out.