Provides polymorphic dispatch resolution.
Provides polymorphic dispatch resolution.
(poly-resolve {entries :entries
val :dispatch-val
default-val :default-dispatch-val
:or {default-val :default}
:as context})
Given a map of entries, performs a polymorphic lookup, possibly returning a default value. Options include:
:entries A map of entries against which the lookup will be performed. Keys should be dispatch values.
:hierarchy A Clojure hierarchy representing isa relationships between types.
:prefers A prefers map. The keys dominate the values, which are provided as sets.
:dispatch-val The dispatch value which will be matched against the entries.
:default-dispatch-val If no match is found, this will be used to lookup the default entry.
Given a map of entries, performs a polymorphic lookup, possibly returning a default value. Options include: :entries A map of entries against which the lookup will be performed. Keys should be dispatch values. :hierarchy A Clojure hierarchy representing isa relationships between types. :prefers A prefers map. The keys dominate the values, which are provided as sets. :dispatch-val The dispatch value which will be matched against the entries. :default-dispatch-val If no match is found, this will be used to lookup the default entry.
(prefer-pairs xs)
(prefer-pairs prefers xs)
Given a sequence of preference pairs, adds them to a prefers
table. Each element in a pair can be cardinality one or
many. Cardinality many elements are distributed combinatorially.
Given a sequence of preference pairs, adds them to a `prefers` table. Each element in a pair can be cardinality one or many. Cardinality many elements are distributed combinatorially.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close