merkel v1.0.1 Merkel.Printer

Module implements pretty printing of merkle binary hash tree

Link to this section Summary

Functions

Prints the merkle binary hash tree rotated to the left 90 degrees so that large trees will fit in the console window

Link to this section Functions

Link to this function pretty_print(arg1)
pretty_print(Merkel.BinaryHashTree.t()) :: :ok

Prints the merkle binary hash tree rotated to the left 90 degrees so that large trees will fit in the console window

We perform a “reverse inorder search” and display the tree rotated left

Inorder is typical left-node-right, but in this case we are doing right-node-left

The rightmost on the first line, all the way down to the leftmost which is one the last line

So given tree: R This will be printed as: 4

/

3 4 R

3

Base case if root is nil, stop recursing and return back

The closer we are to the leaves, indent is higher, the closer to the root index is smaller