(cconj xs item & {:keys [size]})
circular conj adds an item into a collection, droping the last element in case a collection count is greater than a :size. (def l '(10 11 12 13 14 15 16 17)) (take 5 (iterate #(cconj % (rand-int 10) :size 10) l)) => ((10 11 12 13 14 15 16 17) (3 10 11 12 13 14 15 16 17) (9 3 10 11 12 13 14 15 16 17) (5 9 3 10 11 12 13 14 15 16) (2 5 9 3 10 11 12 13 14 15))
circular conj adds an item into a collection, droping the last element in case a collection count is greater than a :size. (def l '(10 11 12 13 14 15 16 17)) (take 5 (iterate #(cconj % (rand-int 10) :size 10) l)) => ((10 11 12 13 14 15 16 17) (3 10 11 12 13 14 15 16 17) (9 3 10 11 12 13 14 15 16 17) (5 9 3 10 11 12 13 14 15 16) (2 5 9 3 10 11 12 13 14 15))
(deep-merge-with f & maps)
like merge-with, but merges maps recursively, appling the given fn only when there's a non-map at a particular level. (deepmerge + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) -> {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}
like merge-with, but merges maps recursively, appling the given fn only when there's a non-map at a particular level. (deepmerge + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4} {:a {:b {:c 2 :d {:z 9} :z 3} :e 100}}) -> {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}
(extract-key-ns m kns)
=> (extract-key-ns {:a/one :a-one :a/two :a-two :b/one :b-one :b/two :b-two} :a)
{:a {:one :a-one :two :a-two}}
=> (extract-key-ns {:a/one :a-one :a/two :a-two :b/one :b-one :b/two :b-two} :a) {:a {:one :a-one :two :a-two}}
(fmv m f)
apply f to each value v of map m
apply f to each value v of map m
(group-by-first m)
takes a seq of 2 element tuples and groups them by the first (key) element. (group-by-first [[1 2][1 4][2 3][2 7]]) {1 (4 2), 2 (7 3)}
takes a seq of 2 element tuples and groups them by the first (key) element. (group-by-first [[1 2][1 4][2 3][2 7]]) {1 (4 2), 2 (7 3)}
(group-by-ns m)
=> (group-by-ns {:a/one :a-one :b/one :b-one :a/two :a-two :b/two :b-two})
{:a {:one :a-one, :two :a-two} :b {:one :b-one, :two :b-two}}
=> (group-by-ns {:a/one :a-one :b/one :b-one :a/two :a-two :b/two :b-two}) {:a {:one :a-one, :two :a-two} :b {:one :b-one, :two :b-two}}
(props->map props)
java.util.Properties to map
java.util.Properties to map
(remove-empty m)
=> (remove-empty {:a nil :b "" :c [] :d 42}) {:d 42}
=> (remove-empty {:a nil :b "" :c [] :d 42}) {:d 42}
(replace-in-kw kw from to)
=> (replace-in-kw :foo-bar-baz "bar" "zoo") :foo-zoo-baz
=> (replace-in-kw :foo-bar-baz "bar" "zoo") :foo-zoo-baz
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close