Functions for working with sorted and hash maps.
Functions for working with sorted and hash maps.
(ceil m k)
The entry whose key is either equal to k, or just above it. If k is less than the minimum value in the map, returns nil.
The entry whose key is either equal to k, or just above it. If k is less than the minimum value in the map, returns nil.
(ceil-index m k)
The index of the entry whose key is either equal to key, or just above it. If key is greater than the maximum value in the map, returns null.
The index of the entry whose key is either equal to key, or just above it. If key is greater than the maximum value in the map, returns null.
(comparator m)
Returns the comparator function for two keys.
Returns the comparator function for two keys.
(contains-all? m other)
True if this map contains all keys in the given map or set.
True if this map contains all keys in the given map or set.
(contains-any? m other)
True if this map contains any keys in the given map or set.
True if this map contains any keys in the given map or set.
(contains? m k)
Does the given map contain a key?
Does the given map contain a key?
(difference m ks)
Takes a map and removes all keys in the given set/map
Takes a map and removes all keys in the given set/map
(entries m)
Returns a list of entries in the map.
Returns a list of entries in the map.
(first m)
The first entry of a sorted map
The first entry of a sorted map
(floor m k)
The entry whose key is either equal to k, or just below it. If k is less than the minimum value in the map, returns nil.
The entry whose key is either equal to k, or just below it. If k is less than the minimum value in the map, returns nil.
(floor-index m k)
The index of the entry whose key is either equal to key, or just below it. If key is less than the minimum value in the map, returns null.
The index of the entry whose key is either equal to key, or just below it. If key is less than the minimum value in the map, returns null.
(from x)
Constructs a map from another collection. Can take a Bifurcan map, a Bifurcan list of Bifurcan Entries, or an iterable/reducible/seqable of anything that can be coerced to an Entry--Clojure map entries, [k v] vector pairs, or Bifurcan entries.
Constructs a map from another collection. Can take a Bifurcan map, a Bifurcan list of Bifurcan Entries, or an iterable/reducible/seqable of anything that can be coerced to an Entry--Clojure map entries, [k v] vector pairs, or Bifurcan entries.
(sorted-map-from x)
Constructs a sorted map from another collection. Can take a Bifurcan map or an iterable/reducible/seqable of anything that can be coerced to an Entry--Clojure map entries, [k v] vector pairs, or Bifurcan entries.
Constructs a sorted map from another collection. Can take a Bifurcan map or an iterable/reducible/seqable of anything that can be coerced to an Entry--Clojure map entries, [k v] vector pairs, or Bifurcan entries.
(from-reduce init pairs)
Takes an initial map and a reducible of things that can be coerced to entries. Adds all those entries to the map and returns the map, forked.
Takes an initial map and a reducible of things that can be coerced to entries. Adds all those entries to the map and returns the map, forked.
(get m k)
(get m k not-found)
Gets a key from a map. Returns the value, or nil if not found. Can take an explicit not-found value.
Gets a key from a map. Returns the value, or nil if not found. Can take an explicit not-found value.
(get-or-create m k f)
Gets a key, or a value generated by (f) if there is no such key.
Gets a key, or a value generated by (f) if there is no such key.
(index-of m k)
Returns the long index of a key, if present, or nil.
Returns the long index of a key, if present, or nil.
(intersection m ks)
Takes a map and retains only the keys in the given set.
Takes a map and retains only the keys in the given set.
(key-equality m)
The key equality function used by this map.
The key equality function used by this map.
(key-hash m)
The key hash function used by this map.
The key hash function used by this map.
(keys m)
Returns the set of keys in the map.
Returns the set of keys in the map.
(map)
(map hash-fn equals-fn)
Constructs an empty map. optionally takes a hash and equality function.
Constructs an empty map. optionally takes a hash and equality function.
(map-values m f)
Transforms all values using a function (f k v).
Transforms all values using a function (f k v).
(merge a b)
(merge a b merge-fn)
Merges two maps together, optionally using the given merge function.
Merges two maps together, optionally using the given merge function.
(put m k v)
(put m k v merge)
Sets a key to a value. Optionally takes a function (merge current-val new-val) to combine an existing value.
Sets a key to a value. Optionally takes a function (merge current-val new-val) to combine an existing value.
(slice m min max)
Returns a sorted map with all entries with keys in [min max] inclusive.
Returns a sorted map with all entries with keys in [min max] inclusive.
(sorted-map)
(sorted-map comparator)
Constructs an empty sorted map with the given comparator.
Constructs an empty sorted map with the given comparator.
(->entry pair)
Coerces a pair to an entry.
Coerces a pair to an entry.
(union m1 m2)
The union of two maps, with values from m2 shadowing m1.
The union of two maps, with values from m2 shadowing m1.
(update m k f)
(update m k f a)
(update m k f a b)
(update m k f a b & more)
Updates a key by applying a function to the current value, or nil if it does not exist. With additional arguments a b ..., calls (f current-value a b ...).
Updates a key by applying a function to the current value, or nil if it does not exist. With additional arguments a b ..., calls (f current-value a b ...).
(values m)
Returns the list of values in the map.
Returns the list of values in the map.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close