Created
December 8, 2013 20:56
-
-
Save rrichardson/7863716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webbitchat.core=> (defmulti send-multi (fn [msg] (-> msg :action keyword))) | |
nil | |
webbitchat.core=> send-multi | |
#<MultiFn clojure.lang.MultiFn@4706c7b2> | |
webbitchat.core=> (defmethod send-multi :SAY [msg] (println "I just called to say: " (:message msg))) | |
#<MultiFn clojure.lang.MultiFn@4706c7b2> | |
webbitchat.core=> (defmethod send-multi :YELL [msg] (println "I JUST CALLED TO YELL: " (clojure.string/upper-case (:message msg)))) | |
#<MultiFn clojure.lang.MultiFn@4706c7b2> | |
webbitchat.core=> (send-multi {:message "I love you" :action "SAY"}) | |
ArityException Wrong number of args (1) passed to: core$fn--666$fn clojure.lang.AFn.throwArity (AFn.java:437) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment