A set of useful collection manipulation functions
A set of useful collection manipulation functions
(filter-map-key filter-fn some-map)
Will filter on key of a hashmap
Will filter on key of a hashmap
(filter-map-val filter-fn some-map)
WIll filter on value of a hashmap
WIll filter on value of a hashmap
(hashmaps->sparse-table datum)
(hashmaps->sparse-table datum null-type)
(hashmaps->sparse-table datum null-type order-by)
Will turn a list of hashmaps into a sparse table. Useful when exporting data into a spreadsheet. First row is a headers row
Will turn a list of hashmaps into a sparse table. Useful when exporting data into a spreadsheet. First row is a headers row
(invert-map dataset)
Turn values into keys and reverse. Basically, an inverted index. See tests for example
Turn values into keys and reverse. Basically, an inverted index. See tests for example
(jaccard a b)
Will calculate Jaccard distance over two sets
Will calculate Jaccard distance over two sets
(jaccard-words some-str some-another-str)
Calculate Jaccard distance between two strings split by space
Calculate Jaccard distance between two strings split by space
(map-longest fn & colls)
Opposite of map. On multiple collections will iterate until the longest sequence has no more members. Will hang when used with lazy collections
Opposite of map. On multiple collections will iterate until the longest sequence has no more members. Will hang when used with lazy collections
(map-val f m)
Will execute function over value of the map
Will execute function over value of the map
(meta-iterate data-set)
Provide metadata in the form {:index :last? :first?} on a collection
Provide metadata in the form {:index :last? :first?} on a collection
(nested-group-by fs coll & [final-fn])
From: https://stackoverflow.com/a/38842018/3362518
Like group-by but instead of a single function, this is given a list or vec
of functions to apply recursively via group-by. An optional final
argument
(defaults to identity) may be given to run on the vector result of the final
group-by. !!careful, deep nesting is not supported
From: https://stackoverflow.com/a/38842018/3362518 Like group-by but instead of a single function, this is given a list or vec of functions to apply recursively via group-by. An optional `final` argument (defaults to identity) may be given to run on the vector result of the final group-by. !!careful, deep nesting is not supported
(order-by-collection input order-coll)
Will order input hashmap by order collection. Will append non appearing at the end
Will order input hashmap by order collection. Will append non appearing at the end
(pad-coll n coll pad-with)
Pad collection <coll> with <pad-with> until <n> is reached
Pad collection <coll> with <pad-with> until <n> is reached
(pad-numbers n c pad-symbol)
Pad numbers - takes a number and the length to pad to as arguments
Pad numbers - takes a number and the length to pad to as arguments
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close