KV Tables

A tab is a data-jetted map from noun to noun.

tabSing

(tabSing key val)
> key : a
> val : b
> Tab a

Creates a singleton table with one key-value pair.

tabSing 1 2        == [1=2]
tabSing {a} {b}    == [a=(%b)]
tabSing 0 []       == [0=[]]

isTab

(isTab x)
> x : a
> Bool

Checks if the given value is a table.

isTab #[]           == 1
isTab #[x=3 y=4]    == 1
isTab []            == 0

tabSearchCase

Inline function that finds the index of a key within a table. Returns a continuation with the associated value.

tabLen

Returns the number of key-value pairs in a table.

tabIdx

Retrieves the value associated with a given key in a table.

tabKeysSet

Returns the set of keys in a table.

tabKeysRow

Returns the row of keys in a table.

tabKeysList

Returns the list of keys in a table.

tabHas

Checks if a key exists in a table.

tabGet

Retrieves the value associated with a given key in a table.

tabValsRow

Returns the row of values in a table.

tabValsList

Returns the list of values in a table.

tabSwitch

Looks up a key in a table, returning a default value if not found.

tabFromPairs

Creates a table from a row of key-value pairs.

tabFromAscPairs

Creates a table from an ascending row of key-value pairs.

tabToPairs

Converts a table to a row of key-value pairs.

tabToPairList

Converts a table to a list of key-value pairs.

tabToList

Converts a table to a list of key-value pairs.

tabPut

Inserts or updates a key-value pair in a table.

tabFromPairsList

Creates a table from a list of key-value pairs.

tabIns

Inserts a key-value pair into a table.

tabIsEmpty

Checks if a table is empty.

tabDel

Deletes a key-value pair from a table.

tabPop

Removes and returns the first key-value pair from a table along with the remaining table.

tabSplitAt

Splits a table into two tables at a given index.

tabSplitLT

Splits a table into two tables based on a key.

tabAlter

Applies a function to the value associated with a key, potentially inserting or deleting the key-value pair.

tabMapWithKey

Applies a function to each key-value pair in a table.

tabMap

Applies a function to each value in a table.

tabUnionWith

Merges two tables, using a function to resolve conflicts.

tabUnion

Merges two tables, with left-biased conflict resolution.

tabWeld

Alias for tabUnion. Merges two tables, with left-biased conflict resolution.

tabCatRow

Merges a row of tables into a single table, with left-biased conflict resolution.

tabLookup

Looks up a key in a table, returning a Maybe value.

tabMinKey

Returns the smallest key in a table.

tabFoldlWithKey

Folds over a table, applying a function to each key-value pair and an accumulator.

tabElemIdx

Returns the index of a key-value pair in a table, treating it as an array.

emptyTab

An empty table constant.

tabInsWith

Inserts a key-value pair into a table, using a function to combine values if the key already exists.

tabFilterWithKey

Filters a table based on a predicate function applied to each key-value pair.

Last updated