Radix.walk
You're seeing just the function
walk
, go back to Radix module for more information.
Specs
Invokes fun
on all (internal and leaf) nodes of the radix tree
using either
:inorder
, :preorder
or :postorder
traversal.
fun
should have the signatures:
Note that leaf/0
might be nil.
Example
iex> t = new([{<<1>>, 1}, {<<2>>, 2}, {<<3>>, 3}, {<<128>>, 128}])
iex>
iex> f = fn
...> (acc, {_bit, _left, _right}) -> acc
...> (acc, nil) -> acc
...> (acc, leaf) -> acc ++ Enum.map(leaf, fn {_k, v} -> v end)
...> end
iex>
iex> walk(t, [], f)
[1, 2, 3, 128]