(assoc-in m path v)
Similar to clojure.core/assoc-in, but uses unification so that existing values are unified rather than overwritten.
Similar to clojure.core/assoc-in, but uses unification so that existing values are unified rather than overwritten.
(assoc-in! m path v)
Similar to assoc-in, but m's references (if any) are modified.
Similar to assoc-in, but m's references (if any) are modified.
If true, and if unifying two DAGs would cause a cycle, thrown an exception. If false, return :fail rather than throwing an exception.
If true, and if unifying two DAGs would cause a cycle, thrown an exception. If false, return :fail rather than throwing an exception.
(get-all-refs d)
return all paths found in dag d.
return all paths found in dag _d_.
(get-in in-map path & [not-found])
same as clojure.core (get-in), but references are resolved and followed.
same as clojure.core (get-in), but references are resolved and followed.
(paths d & [prefix])
return all paths found in dag d.
return all paths found in dag _d_.
(resolve-ref arg)
if arg is not a ref, return arg. if is a ref, return (resolve @arg)
if arg is not a ref, return arg. if is a ref, return (resolve @arg)
(subsumes? a b)
Returns true if dag a is more general than dag b, or more precisely, dag a subsumes dag b if: for all p in paths(a), (unify (get-in a p) (get-in b p :fail)) is not fail.
For example, (subsumes? {:a 42} {:a 42, :b 43}) => true but: (subsumes? {:a 42, :b 43} {:a 42}) => false.
Returns true if dag _a_ is more general than dag _b_, or more precisely, dag _a_ subsumes dag _b_ if: for all _p_ in paths(a), (unify (get-in a _p_) (get-in b _p_ :fail)) is not fail. For example, (subsumes? {:a 42} {:a 42, :b 43}) => true but: (subsumes? {:a 42, :b 43} {:a 42}) => false.
(unify val1 val2)
like unify!, but non-destructively copy each argument before unifying.
like unify!, but non-destructively copy each argument before unifying.
(unify! val1 val2)
Merge input arguments val1 and val2, according to their types:
If val1 and val2 are maps, merge recursively (via unify-dags).
If val1 and/or val2 are references (Atoms), the references(s) will be updated to point to the unification of the resolved reference(s).
If val1 and/or val2 are atomic values (e.g. strings, numbers, etc), the unification is their equal value if they are equal, according to =, or :fail if they are not equal according to =.
If a cycle is detected during unification, for example, if val1 is: {:a [[1] :top] :c [[1]]}}
and val2 is:
{:a {:b [[2] :top] :c [[2]]}},
then this function will return :fail if the dynamic variable exception-if-cycle? (declared above) is false. However, if exception-if-cycle? is set to true, this function will throw an exception. See core_test.clj/prevent-cyclic-graph-* functions for examples.
Cycle detection is done by checking: if val1 is ref and val2 is not a ref: checking that val1 is not a member of (get-all-refs val2). if val1 is not a ref and val2 is a ref: checking that val2 is not a member of (get-all-refs val1). if both val1 and val2 are refs: checking both of the above checks.
Merge input arguments val1 and val2, according to their types: - If val1 and val2 are maps, merge recursively (via unify-dags). - If val1 and/or val2 are references (Atoms), the references(s) will be updated to point to the unification of the resolved reference(s). - If val1 and/or val2 are atomic values (e.g. strings, numbers, etc), the unification is their equal value if they are equal, according to =, or :fail if they are not equal according to =. - If a cycle is detected during unification, for example, if val1 is: {:a [[1] :top] :c [[1]]}} and val2 is: {:a {:b [[2] :top] :c [[2]]}}, then this function will return :fail if the dynamic variable exception-if-cycle? (declared above) is false. However, if exception-if-cycle? is set to true, this function will throw an exception. See core_test.clj/prevent-cyclic-graph-* functions for examples. Cycle detection is done by checking: if val1 is ref and val2 is not a ref: checking that val1 is *not* a member of (get-all-refs val2). if val1 is not a ref and val2 is a ref: checking that val2 is *not* a member of (get-all-refs val1). if both val1 and val2 are refs: checking both of the above checks.
(unify-dags dag1 dag2)
Destructively unify two maps into a single map (or :fail) by taking the union of their keys and for each :k in this union, unify the two values of :k, and use that unified value as the :k of the returned map.
Destructively unify two maps into a single map (or :fail) by taking the union of their keys and for each :k in this union, unify the two values of :k, and use that unified value as the :k of the returned map. - If the unified value for :k is :fail, then return :fail for the whole function call.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close