This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-13
Channels
- # announcements (4)
- # babashka (8)
- # beginners (28)
- # calva (20)
- # clerk (3)
- # clj-kondo (5)
- # clojure (50)
- # clojure-conj (1)
- # clojure-dev (69)
- # clojure-europe (52)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-uk (1)
- # clojurescript (5)
- # copenhagen-clojurians (1)
- # cursive (4)
- # datascript (1)
- # datomic (8)
- # fulcro (2)
- # funcool (1)
- # garden (2)
- # helix (2)
- # holy-lambda (2)
- # hyperfiddle (27)
- # introduce-yourself (6)
- # jobs-discuss (4)
- # lsp (3)
- # membrane (1)
- # off-topic (34)
- # react (4)
- # releases (1)
- # shadow-cljs (23)
- # tools-deps (11)
- # xtdb (4)
I am using a multimethod (demulti) that handles a couple of stuff, which for example it takes "string" or "number" and return accordingly. How do I create a method that returns something for everything else not handled? Like a default defmethod
something like (defprotocol PrettyPrintable (pprint [this])) (extend-type String PrettyPrintable (pprint [this] (clojure.pprint/pprint this))) (syntax is probably wrong but you get the idea) instead of (defmulti pprint (fn [obj] (type obj)))
@U02F0C62TC1 aside: type
was enough, instead of (fn [obj] (type obj))