std.lib.transform.base.combine

combine

added in 3.0

(combine)(combine m)(combine v1 v2)(combine v1 v2 sel func)

takes v1 and v2, which can be either values or sets of values and merges them into a new set.

(combine 1 2) => #{1 2}

(combine #{1} 1) => #{1}

(combine #{{:id 1} {:id 2}} #{{:id 1 :val 1} {:id 2 :val 2}} :id merge) => #{{:id 1 :val 1} {:id 2 :val 2}}

combine-internal

added in 3.0

(combine-internal set sel rd)

Combines all elements in a single using sel and func

(combine-internal #{{:id 1} {:id 2} {:id 1 :val 1} {:id 2 :val 2}} :id merge) => #{{:id 1 :val 1} {:id 2 :val 2}}

combine-select

added in 3.0

(combine-select set val sel)

selects an element out of the set that matches sel when it is applied

(combine-select #{1 2 3} 2 identity) => 2

(combine-select #{{:id 1 :val 2} {:id 2 :val 2}} {:id 1 :val 1} :id) => {:id 1 :val 2}

combine-set

added in 3.0

(combine-set s1 s2 sel func)

Returns the combined set of s1 and s2 using sel for item comparison and func as the combine function

(combine-set #{{:id 1 :val 0} {:id 2 :a 0}} #{{:id 1 :val 1} {:id 2 :val 2}} :id merge) => #{{:id 1 :val 1} {:id 2 :val 2 :a 0}}

combine-value

added in 3.0

(combine-value set val sel func)

returns a single set, sel is used for item comparison while func is used as the combine function

(combine-value #{{:id 1 :a 1} {:id 2 :a 2}} {:id 3 :b 3} :id merge) => #{{:id 1, :a 1} {:id 2, :a 2} {:id 3, :b 3}}

(combine-value #{{:id 1 :a 1} {:id 2 :a 2}} {:id 1 :b 3} :id merge) => #{{:id 1 :a 1 :b 3} {:id 2 :a 2}}

decombine

added in 3.0

(decombine v dv)

takes set or value v and returns a set with elements matching sel removed

(decombine 1 1) => nil

(decombine 1 2) => 1

(decombine #{1} 1) => nil

(decombine #{1 2 3 4} #{1 2}) => #{3 4}

(decombine #{1 2 3 4} even?) => #{1 3}