Liking cljdoc? Tell your friends :D

hara.data.base.complex


assocsclj

(assocs m k v)
(assocs m k v sel func)

Similar to assoc but conditions of association is specified through sel (default: identity) and well as merging specified through func (default: combine). (assocs {:a #{1}} :a #{2 3 4}) => {:a #{1 2 3 4}}

(assocs {:a {:id 1}} :a {:id 1 :val 1} :id merge) => {:a {:val 1, :id 1}}

(assocs {:a #{{:id 1 :val 2} {:id 1 :val 3}}} :a {:id 1 :val 4} :id merges) => {:a #{{:id 1 :val #{2 3 4}}}}

Similar to `assoc` but conditions of association is specified
through `sel` (default: `identity`) and well as merging specified
through `func` (default: `combine`).
(assocs {:a #{1}} :a #{2 3 4})
=> {:a #{1 2 3 4}}

(assocs {:a {:id 1}} :a {:id 1 :val 1} :id merge)
=> {:a {:val 1, :id 1}}

(assocs {:a #{{:id 1 :val 2}
              {:id 1 :val 3}}} :a {:id 1 :val 4} :id merges)
=> {:a #{{:id 1 :val #{2 3 4}}}}
raw docstring

assocs-inclj

(assocs-in m all-ks v)
(assocs-in m [k & ks :as all-ks] v sel func)

Similar to assoc-in but can move through sets

(assocs-in {:a {:b 1}} [:a :b] 2) => {:a {:b #{1 2}}}

(assocs-in {:a #{{:b 1}}} [:a :b] 2) => {:a #{{:b #{1 2}}}}

(assocs-in {:a #{{:b {:id 1}} {:b {:id 2}}}} [:a [:b [:id 1]] :c] 2) => {:a #{{:b {:id 1 :c 2}} {:b {:id 2}}}}

Similar to assoc-in but can move through sets

(assocs-in {:a {:b 1}} [:a :b] 2)
=> {:a {:b #{1 2}}}

(assocs-in {:a #{{:b 1}}} [:a :b] 2)
=> {:a #{{:b #{1 2}}}}

(assocs-in {:a #{{:b {:id 1}} {:b {:id 2}}}}
           [:a [:b [:id 1]] :c] 2)
=> {:a #{{:b {:id 1 :c 2}} {:b {:id 2}}}}
raw docstring

assocs-in-filteredclj

(assocs-in-filtered m all-ks v)
(assocs-in-filtered m [[k prchk] & ks :as all-ks] v sel func)

allows a selector to be included for assocs-in

(assocs-in-filtered {:a #{{:b {:id 1}} {:b {:id 2}}}} [[:a] [:b [:id 1]] :c] 2) => {:a #{{:b {:id 1 :c 2}} {:b {:id 2}}}}

allows a selector to be included for assocs-in

(assocs-in-filtered {:a #{{:b {:id 1}} {:b {:id 2}}}}
                    [[:a] [:b [:id 1]] :c] 2)
=> {:a #{{:b {:id 1 :c 2}} {:b {:id 2}}}}
raw docstring

dissocsclj

(dissocs m k)

Similar to dissoc but allows dissassociation of sets of values from a map.

(dissocs {:a 1} :a) => {}

(dissocs {:a #{1 2}} [:a #{0 1}]) => {:a #{2}}

(dissocs {:a #{1 2}} [:a #{1 2}]) => {}

Similar to `dissoc` but allows dissassociation of sets of values from a map.

(dissocs {:a 1} :a)
=> {}

(dissocs {:a #{1 2}} [:a #{0 1}])
=> {:a #{2}}

(dissocs {:a #{1 2}} [:a #{1 2}])
=> {}
raw docstring

dissocs-inclj

(dissocs-in m [k & ks :as all-ks])

Similiar to dissoc-in but can move through sets.

(dissocs-in {:a #{{:b 1 :c 1} {:b 2 :c 2}}} [:a :b]) => {:a #{{:c 1} {:c 2}}}

(dissocs-in {:a #{{:b #{1 2 3} :c 1} {:b #{1 2 3} :c 2}}} [[:a [:c 1]] [:b 1]]) => {:a #{{:b #{2 3} :c 1} {:b #{1 2 3} :c 2}}}

Similiar to `dissoc-in` but can move through sets.

(dissocs-in {:a #{{:b 1 :c 1} {:b 2 :c 2}}}
            [:a :b])
=> {:a #{{:c 1} {:c 2}}}

(dissocs-in {:a #{{:b #{1 2 3} :c 1}
                  {:b #{1 2 3} :c 2}}}
            [[:a [:c 1]] [:b 1]])
=> {:a #{{:b #{2 3} :c 1} {:b #{1 2 3} :c 2}}}
raw docstring

getsclj

(gets m k)

Returns the associated values either specified by a key or a key and predicate pair.

(gets {:a 1} :a) => 1

(gets {:a #{0 1}} [:a zero?]) => #{0}

(gets {:a #{{:b 1} {}}} [:a :b]) => #{{:b 1}}

Returns the associated values either specified by a key or a key and predicate pair.

(gets {:a 1} :a) => 1

(gets {:a #{0 1}} [:a zero?]) => #{0}

(gets {:a #{{:b 1} {}}} [:a :b]) => #{{:b 1}}
raw docstring

gets-inclj

(gets-in m ks)

Similar in style to get-in with operations on sets. returns a set of values.

(gets-in {:a 1} [:a]) => #{1}

(gets-in {:a 1} [:b]) => #{}

(gets-in {:a #{{:b 1} {:b 2}}} [:a :b]) => #{1 2}

Similar in style to `get-in` with operations on sets. returns a set of values.

(gets-in {:a 1} [:a]) => #{1}

(gets-in {:a 1} [:b]) => #{}

(gets-in {:a #{{:b 1} {:b 2}}} [:a :b]) => #{1 2}
raw docstring

mergesclj

(merges m1 m2)
(merges m1 m2 sel)
(merges m1 m2 sel func)

Like merge but works across sets and will also combine duplicate key/value pairs together into sets of values.

(merges {:a 1} {:a 2}) => {:a #{1 2}}

(merges {:a #{{:id 1 :val 1}}} {:a {:id 1 :val 2}} :id merges) => {:a #{{:id 1 :val #{1 2}}}}

Like `merge` but works across sets and will also
 combine duplicate key/value pairs together into sets of values.

(merges {:a 1} {:a 2})
=> {:a #{1 2}}

(merges {:a #{{:id 1 :val 1}}}
        {:a {:id 1 :val 2}}
        :id merges)
=> {:a #{{:id 1 :val #{1 2}}}}
raw docstring

merges-nestedclj

(merges-nested)
(merges-nested m)
(merges-nested m1 m2)
(merges-nested m1 m2 sel)
(merges-nested m1 m2 sel func)

Like merges but works on nested maps

(merges-nested {:a {:b 1}} {:a {:b 2}}) => {:a {:b #{1 2}}}

(merges-nested {:a #{{:foo #{{:bar #{{:baz 1}}}}}}} {:a #{{:foo #{{:bar #{{:baz 2}}}}}}} hash-map? merges-nested) => {:a #{{:foo #{{:bar #{{:baz 2}}} {:bar #{{:baz 1}}}}}}}

Like `merges` but works on nested maps

(merges-nested {:a {:b 1}} {:a {:b 2}})
=> {:a {:b #{1 2}}}

(merges-nested {:a #{{:foo #{{:bar #{{:baz 1}}}}}}}
               {:a #{{:foo #{{:bar #{{:baz 2}}}}}}}
               hash-map?
               merges-nested)
=> {:a #{{:foo #{{:bar #{{:baz 2}}}
                 {:bar #{{:baz 1}}}}}}}
raw docstring

merges-nested*clj

(merges-nested*)
(merges-nested* m)
(merges-nested* m1 m2)
(merges-nested* m1 m2 sel)
(merges-nested* m1 m2 sel func)

Like `merges-nested but can recursively merge nested sets and values

(merges-nested* {:a #{{:id 1 :foo #{{:id 2 :bar #{{:id 3 :baz 1}}}}}}} {:a {:id 1 :foo {:id 2 :bar {:id 3 :baz 2}}}} :id)

=> {:a #{{:id 1 :foo #{{:id 2 :bar #{{:id 3 :baz #{1 2}}}}}}}}

Like `merges-nested but can recursively merge nested sets and values

(merges-nested* {:a #{{:id 1 :foo
                       #{{:id 2 :bar
                          #{{:id 3 :baz 1}}}}}}}
                {:a {:id 1 :foo
                     {:id 2 :bar
                      {:id 3 :baz 2}}}}
                :id)

=> {:a #{{:id 1 :foo
         #{{:id 2 :bar
             #{{:id 3 :baz #{1 2}}}}}}}}
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close