std.lib.invoke
definvoke
macro
added in 3.0
(definvoke name doc? & [attrs? & [params & body :as more]])customisable invocation forms
(definvoke -another- [:compose {:val (partial + 10) :arglists ’(& more)}])
fn-body
added in 3.0
(fn-body label body)creates a function body
(fn-body :clojure ’([](+ 1 1))) => ’(clojure.core/fn [](+ 1 1))
fn-body-clojure
added in 3.0
(fn-body-clojure body)(fn-body-clojure _ body)creates a clojure function body
(fn-body-clojure nil ’([](+ 1 1))) => ’(clojure.core/fn [](+ 1 1))
invoke-intern
added in 3.0
(invoke-intern label name config body)main function to call for definvoke
(invoke-intern :method ’-hello-method- {:multi ’-hello-multi- :val :apple} ’(x x)) => ’(clojure.core/let [v (def -hello-method- (clojure.core/fn -hello-method- x x))] (std.lib.invoke/multi:add -hello-multi- :apple -hello-method-) v)
invoke-intern-compose
added in 3.0
(invoke-intern-compose _ name {:keys [val arglists], :as config} _)method body for :compose form
(invoke-intern-compose :compose ’-compose-form- {:val ’(partial + 1 2) :arglists ''(& more)} nil)
invoke-intern-dynamic
added in 3.0
(invoke-intern-dynamic _ name config _)constructs a body for the :dynamic keyword
(invoke-intern-dynamic nil ’-hello- {:val :world} nil)
invoke-intern-fn
added in 3.0
(invoke-intern-fn _ name config body)method body for :fn invoke
(invoke-intern-fn :fn ’-fn-form- {} ’(x x))
invoke-intern-macro
added in 3.0
(invoke-intern-macro _ name {:keys [args fn], :as config} _)invoke-intern-method
added in 3.0
(invoke-intern-method name {:keys [multi val], :as config} body)creates a :method form, similar to defmethod
(defmulti -hello-multi- identity) (invoke-intern-method ’-hello-method- {:multi ’-hello-multi- :val :apple} ’(x x))
invoke-intern-multi
added in 3.0
(invoke-intern-multi _ name {:keys [refresh default hierarchy], :as config} body)method body for :multi form
(invoke-intern-multi :multi ’-multi-form- {} ’(x x))
invoke-intern-recent
added in 3.0
(invoke-intern-recent _ name {:keys [key compare function cache], :as config} body)creates a body for recent
invoke:arglists
added in 3.0
(invoke:arglists body)multi:add
added in 3.0
(multi:add multi dispatch-val method)adds an entry to the multimethod
(multi:add hello :c (clojure.core/fn m(assoc m :c 3))) => hello
multi:clone
added in 3.0
(multi:clone source name)creates a multimethod from an existing one
multi:get
added in 3.0
(multi:get multi dispatch)returns all entries in the multimethod
(multi:get hello :a) => fn?
multi:list
added in 3.0
(multi:list multi)returns all entries in the multimethod
(keys (multi:list world)) => (contains :a :b :in-any-order)
multi:match?
added in 3.0
(multi:match? multi method)(multi:match? multi method throw?)checks if the multi dispatch matches the arguments
(multi:match? (.dispatchFn ^MultiFn hello) (clojure.core/fn _)) => true
multi:remove
added in 3.0
(multi:remove multi val)removes an entry
(multi:remove world :b) => ifn?
multi?
added in 3.0
(multi? obj)returns true if obj is a multimethod
(multi? print-method) => true
(multi? println) => false
recent-fn
added in 3.0
(recent-fn {:keys [key compare op cache]})creates a recent function
resolve-method
added in 3.0
(resolve-method mmethod pkgmethod label lookup)resolves a package related to a label
(resolve-method protocol.invoke/-invoke-intern protocol.invoke/-invoke-package :fn +default-packages+) => nil