alter: Add or remove trie entries

alterR Documentation

Add or remove trie entries

Description

trie_add and trie_remove allow you to add or remove entries from tries, respectively.

Usage

trie_add(trie, keys, values)

trie_remove(trie, keys)

Arguments

trie

a trie object created with trie

keys

a character vector containing the keys of the entries to add (or remove). Entries with NA keys will not be added.

values

an atomic vector, matching the type of the trie, containing the values of the entries to add. Entries with NA values will not be added.

Value

nothing; the trie is modified in-place

See Also

trie for creating tries in the first place.

Examples

trie <- trie("foo", "bar")
length(trie)

trie_add(trie, "baz", "qux")
length(trie)

trie_remove(trie, "baz")
length(trie)


triebeard documentation built on March 7, 2023, 6:55 p.m.