/sorted-map
B-Tree backed ordered map (Sorted-Map) maintaining keys in ascending sorted order.
Functions & symbols#
Sorted-Map#
Constructs a mutable `Sorted-Map` instance.
| Parameter | Type | Optional | Description |
|---|---|---|---|
initial | Map | Array | optional | Optional initial Map or [k v] pairs |
Any(let m (Sorted-Map {:b 2 :a 1}))contains-key?#
Returns `true` if `key` exists in the map.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Map |
key | Any | required | Key to test |
Any(m/contains-key? m :b)count#
Alias of `count-of`: returns the entry count.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(m/count m)count-of#
Returns the number of entries currently stored.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(count-of m)entries-of#
Returns all `[key value]` pairs as an Array.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(entries-of m)first-entry#
Returns the `[key value]` pair with the smallest key, or `()`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(sorted-map/first-entry m)get#
Looks up `key` in `Sorted-Map`, returning `default` or `()` if missing.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Map |
key | Any | required | Key to look up |
default | Any | optional | Optional fallback when key absent |
Any(m/get m :a)into-iter#
Returns an iterator yielding `[key value]` pairs.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(into-iter m)is-empty?#
Returns `true` when the map has zero entries.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(is-empty? m)keys-of#
Returns all keys as an Array (sorted for `Sorted-Map`).
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(keys-of m)last-entry#
Returns the `[key value]` pair with the largest key, or `()`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(sorted-map/last-entry m)put#
Inserts or updates `key -> value` inside `Sorted-Map`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Mutable map |
key | Any | required | Entry key |
value | Any | required | Entry value |
Any(m/put m :c 3)remove#
Removes `key` and returns its previous value (or `()`).
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Mutable map |
key | Any | required | Key to delete |
Any(m/remove m :a)values-of#
Returns all values matching key order as an Array.
| Parameter | Type | Optional | Description |
|---|---|---|---|
map | Sorted-Map | required | Sorted-Map instance |
Any(values-of m)