Dispatch functions take a Class
argument and return the looked-up value.
This provides similar functionality to Clojure's protocols, but operates over
locally-constructed logic rather than using a global dispatch table.
A simple example is a map from classes to values, which can be used directly as a lookup function.
Dispatch functions take a `Class` argument and return the looked-up value. This provides similar functionality to Clojure's protocols, but operates over locally-constructed logic rather than using a global dispatch table. A simple example is a map from classes to values, which can be used directly as a lookup function.
(caching-lookup dispatch)
Builds a dispatcher which caches values returned for each type. This improves performance when the underlying dispatcher may need to perform complex lookup logic to determine the dispatched value.
Builds a dispatcher which caches values returned for each type. This improves performance when the underlying dispatcher may need to perform complex lookup logic to determine the dispatched value.
(chained-lookup dispatchers)
(chained-lookup a b & more)
Builds a dispatcher which looks up a type by checking multiple dispatchers in order until a matching entry is found. Takes either a single collection of dispatchers or a variable list of dispatcher arguments. Ignores nil dispatchers in the sequence.
Builds a dispatcher which looks up a type by checking multiple dispatchers in order until a matching entry is found. Takes either a single collection of dispatchers or a variable list of dispatcher arguments. Ignores nil dispatchers in the sequence.
(inheritance-lookup dispatch)
Builds a dispatcher which looks up a type by looking up the type itself,
then attempting to look up its ancestor classes, implemented interfaces, and
finally java.lang.Object
.
Builds a dispatcher which looks up a type by looking up the type itself, then attempting to look up its ancestor classes, implemented interfaces, and finally `java.lang.Object`.
(predicate-lookup types)
Look up a handler for a value based on a map from predicate to handler
Look up a handler for a value based on a map from predicate to handler
(symbolic-lookup dispatch)
Builds a dispatcher which looks up a type by checking the underlying lookup using the type's symbolic name, rather than the class value itself. This is useful for checking configuration that must be created in situations where the classes themselves may not be loaded yet.
Builds a dispatcher which looks up a type by checking the underlying lookup using the type's _symbolic_ name, rather than the class value itself. This is useful for checking configuration that must be created in situations where the classes themselves may not be loaded yet.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close