This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-30
Channels
- # announcements (2)
- # bangalore-clj (6)
- # beginners (33)
- # cider (4)
- # clojure (9)
- # clojure-brasil (2)
- # clojure-spec (6)
- # clojurescript (36)
- # cursive (13)
- # datomic (3)
- # emacs (1)
- # fulcro (6)
- # graalvm (2)
- # interop (4)
- # luminus (1)
- # midje (1)
- # pathom (1)
- # random (1)
- # reagent (4)
- # shadow-cljs (11)
- # tools-deps (42)
- # xtdb (10)
what's the time complexity of multimethod dispatch? Does it do something clever with the dispatch values like case
to avoid having to compare with each individually?
e.g. if I'm dispatching based on a 2 -element vector and have dozens of defmethods with the first element = :a
and differing in the second
@qythium https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/MultiFn.java suggests it's a map
that's interesting, I wonder why the case
macro goes to so much trouble for constant-time performance when a simple hash map lookup is also O(1)
a hash map lookup isn't O(1), and the constant factors are significantly different
Earlier today I asked about whether anyone was aware of a way to use Datomic's pull syntax on vanilla Clojure data structures (without Datomic). Turns out Juxt wrote a nice library for it (https://github.com/juxt/pull), but in case anyone else has use for a simple standalone version that could be copy-pasted into a util namespace, I stuck my version in a gist: https://gist.github.com/eggsyntax/47ba79302f750bb70e9028aa67268500