(extend-abstract typesym protocolsyms & {:as options})Creates a set of abstract multimethods as well as extends a set of protocols to a given type
(extend-abstract Envelope [IData] :select - :suffix -env :prefix nil :wrappers {-data (str "hello " %)} :dispatch :type :defaults {nil ([this & args] (Exception. "No input")) -data ([this] (:hello this))})
(data-env (map->Envelope {:hello "world"})) => "world"
(-data (map->Envelope {:hello "world"})) => "hello world"
Creates a set of abstract multimethods as well as extends a set of
protocols to a given type
(extend-abstract
Envelope [IData]
:select -
:suffix -env
:prefix nil
:wrappers {-data (str "hello " %)}
:dispatch :type
:defaults {nil ([this & args] (Exception. "No input"))
-data ([this] (:hello this))})
(data-env (map->Envelope {:hello "world"}))
=> "world"
(-data (map->Envelope {:hello "world"}))
=> "hello world"(extend-all proto ptmpls & args)Transforms a protocl template into multiple extend-type expresions
(macroexpand-1 '(extend-all Magma [(op ([x y] (% x y)))]
Number [op-number]
[List Vector] [op-list]))
=> '(do (clojure.core/extend-type Number Magma (op ([x y] (op-number x y)))) (clojure.core/extend-type List Magma (op ([x y] (op-list x y)))) (clojure.core/extend-type Vector Magma (op ([x y] (op-list x y)))))
Transforms a protocl template into multiple extend-type expresions
(macroexpand-1
'(extend-all Magma
[(op ([x y] (% x y)))]
Number [op-number]
[List Vector] [op-list]))
=> '(do (clojure.core/extend-type Number Magma (op ([x y] (op-number x y))))
(clojure.core/extend-type List Magma (op ([x y] (op-list x y))))
(clojure.core/extend-type Vector Magma (op ([x y] (op-list x y)))))(extend-implementations protocolsyms & {:as options})Creates a set of implementation functions for implementation of protocol functionality
(extend-implementations [IData] :wrappers (fn [form _] (list 'str form " again")))
(data (map->Envelope {:hello "world"})) => "hello world again"
Creates a set of implementation functions for implementation
of protocol functionality
(extend-implementations
[IData]
:wrappers (fn [form _]
(list 'str form " again")))
(data (map->Envelope {:hello "world"}))
=> "hello world again"(include & [opts? & sources])Imports all or a selection of vars from one namespace to the current one.
(include (hara.core.base.check atom? long?)) (eval '(long? 1)) => true (eval '(atom? 1)) => false
(include {:fn (fn [ns sym var] (intern ns sym (fn [x] (@var (bigint x)))))} (hara.core.base.check bigint?)) (eval '(bigint? 1)) => true
(include {:ns 'clojure.core} (hara.core.base.check bigint?)) => [#'clojure.core/bigint?]
Imports all or a selection of vars from one namespace to the current one.
(include (hara.core.base.check atom? long?))
(eval '(long? 1)) => true
(eval '(atom? 1)) => false
(include
{:fn (fn [ns sym var]
(intern ns sym (fn [x] (@var (bigint x)))))}
(hara.core.base.check bigint?))
(eval '(bigint? 1)) => true
(include
{:ns 'clojure.core}
(hara.core.base.check bigint?))
=> [#'clojure.core/bigint?]
(link & [opts? & sources])creates links to vars that can be resolved in a controllable manner
(link {:resolve :lazy} (hara.core.base.check atom?))
(meta #'atom?) => {:name 'atom?, :ns ns}
creates links to vars that can be resolved in a controllable manner
(link
{:resolve :lazy}
(hara.core.base.check atom?))
(meta #'atom?) => {:name 'atom?, :ns *ns*}(registered-link? link)checks if a link is registered
(registered-link? -lnk-) => false
checks if a link is registered (registered-link? -lnk-) => false
(registered-links)(registered-links registry)returns all registered links
(register-link -lnk-) => #'hara.module.base.link-test/-lnk-
(registered-links) => (contains [(exactly #'-lnk-)])
returns all registered links (register-link -lnk-) => #'hara.module.base.link-test/-lnk- (registered-links) => (contains [(exactly #'-lnk-)])
(resolve-links)(resolve-links registry)resolves all unresolved links in a background thread
(resolve-links)
resolves all unresolved links in a background thread (resolve-links)
(unresolved-links)(unresolved-links registry)returns all unresolved links
(unresolved-links)
returns all unresolved links (unresolved-links)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |