Beta release (0.1.0) of faster-multimethods, which brings multimethod
lookup overhead to roughly the same cost as protocols, with only modest
changes to the Clojure 1.8.0 implementation.
It is mostly backwards compatible with Clojure 1.8.0. I would very much
appreciate feedback on the semantic
It seems to me that defmulti should create a new instance of MultiFn,
initialized with the method tables from the existing MultiFn, if any.
Then alter-var-root to update the Var holding the MultiFn.
A possible problem is that a new dispatch function might be inconsistent
with the existing keys a
I'd like to be able to do something like:
(defn square ^double [^double x] (* x x))
(def meta-square (with-meta square {:domain Double/TYPE :codomain Double/TYPE
:range {:from 0.0 :to Double/POSITIVE_INFINITY :also Double/NaN}})
https://clojure.org/reference/metadata says "Symbols and collection
A related but slightly different issue: is prefer-method supposed to be
transitive?
That is, (prefer-method f a b) and (prefer-method f b c) implies
(prefer-method f a c)?
Here is a unit test that checks for transitivity (which fails in Clojure
1.8.0):
(test/deftest transitive
(derive ::tra
prefers(x,y) visits ancestors by calling parents.invoke() recursively.
This visits the parents in the global hierarchy, not the multimethod's
hierarchy.
Is this the intended behavior? Why would that be?
On the assumption that prefer-method should behave the same for a local vs
the global-hierar
prefers(x,y) checks the ancestors of x, and returns true if any of them are
preferred to y --- which makes sense to me.
However, it also check the ancestors of y, and returns true if x is
preferred to any of them, which I don't understand.
Is that the intended behavior? Seems like it should be