multimethod noob question

2013-06-22 Thread Dennis Haupt
hi, i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n what exactly is int or

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
Dennis Haupt d.haup...@gmail.com writes: i was taking a look at multimethods: (defmulti fac int) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*' n (fac (dec n this works however, this also works: (defmulti fac print) (defmethod fac 1 [_] 1) (defmethod fac :default [n] (*'

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
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

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
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

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? 2013/6/22 Chris Bilson cbil...@pobox.com Dennis Haupt d.haup...@gmail.com writes: i am not trying anything, i just want to figure out what happens. this

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
(ns experiments.MultiMethod) (defmulti fac identity) (defmethod fac 1 [n] (print n: n - ) 1) (defmethod fac :default [n] (*' n (fac (dec n (print (fac 125)) if i am getting this right, defmethod fac stuff [stuff2] is the equivalent to a scala or haskell pattern match, where stuff is the match

Re: multimethod noob question

2013-06-22 Thread Chris Bilson
Dennis Haupt d.haup...@gmail.com writes: yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? Yes, that's what I meant by my inspect method in my original reply. It prints the value and passes it along:

Re: multimethod noob question

2013-06-22 Thread Dennis Haupt
identity :) 2013/6/22 Chris Bilson cbil...@pobox.com Dennis Haupt d.haup...@gmail.com writes: yes. all glory to the repl that makes me figure out the internals via experiments :D is there a way to just pass the given value along? Yes, that's what I meant by my inspect method in my