Radix.split
You're seeing just the function
split
, go back to Radix module for more information.
Specs
Extracts the key,value-pairs associated with keys
from tree
into a new
radix tree.
Returns the new tree and the old tree with the key,value-pairs removed.
By default an exact match is used, specify match: :lpm
to match based
on a longest prefix match.
If none of the given keys
match, the new tree will be empty and the old
tree unchanged.
Examples
iex> tree = new([{<<0>>, 0}, {<<1>>, 1}, {<<2>>, 2}, {<<3>>, 3}])
iex> {t1, t2} = split(tree, [<<0>>, <<2>>])
iex> keys(t1)
[<<0>>, <<2>>]
iex> keys(t2)
[<<1>>, <<3>>]
iex> tree = new([{<<0>>, 0}, {<<1>>, 1}, {<<2>>, 2}, {<<3>>, 3}])
iex> {t1, t2} = split(tree, [<<0, 0>>, <<2, 0>>], match: :lpm)
iex> keys(t1)
[<<0>>, <<2>>]
iex> keys(t2)
[<<1>>, <<3>>]