(defgen generic handlers & fn-tail)
Add or update a specialization of a generic dispatch multi-method.
The generic argument must refer to a method defined by a defgenera
-class macro.
The handlers argument is a list of handler functions. There must be one handler in each argument position. If all handlers return a truthy value, the function will be dispatched.
The rest of the arguments are the same as the body of a clojure (fn ...) expression.
Add or update a specialization of a generic dispatch multi-method. The generic argument must refer to a method defined by a [[defgenera]]-class macro. The handlers argument is a list of handler functions. There must be one handler in each argument position. If all handlers return a truthy value, the function will be dispatched. The rest of the arguments are the same as the body of a clojure (fn ...) expression.
(defgen! generic handlers fn)
(defgen* generic handlers fn)
(defgen= generic handlers const)
(defgenera name arity & fn-tail)
Create a new generic dispatch multi-method with the given name and arity.
This version also defines a function body that will be called in case no
defgen
-type method is able to be dispatched. The fn-tail arity must match
the specified arity, but otherwise is the same as the body of a clojure
(fn ...) expression.
Create a new generic dispatch multi-method with the given name and arity. This version also defines a function body that will be called in case no [[defgen]]-type method is able to be dispatched. The fn-tail arity must match the specified arity, but otherwise is the same as the body of a clojure (fn ...) expression.
(defgenera* name arity default-handler)
(defgenera* name arity doc default-handler)
Create a new generic dispatch multi-method with the given name and arity.
This version is given a default-handler function that will be called in case
no defgen
-type method is able to be dispatched. The default-handler must
handle the specified arity.
Create a new generic dispatch multi-method with the given name and arity. This version is given a default-handler function that will be called in case no [[defgen]]-type method is able to be dispatched. The default-handler must handle the specified arity.
(defgenera= name arity default-value)
(defgenera= name arity doc default-value)
Create a new generic dispatch multi-method with the given name and arity.
This version is given a default value that will be returned in case
no defgen
-type method is able to be dispatched.
Create a new generic dispatch multi-method with the given name and arity. This version is given a default value that will be returned in case no [[defgen]]-type method is able to be dispatched.
(defmethod! multifn dispatch-val fn)
Add the given function as a handler. Memoized with lru 1024 deep.
Add the given function as a handler. Memoized with lru 1024 deep.
(defmethod* multifn dispatch-val fn)
Add the given function as a handler
Add the given function as a handler
(defmethod= multifn dispatch-val value)
Return the given constant when this handler is reached.
Return the given constant when this handler is reached.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close