Returns a string describing the tree, on a single line. This function is curried, takes a printing function for the values as first parameter, and then returns a function taking the root of a tree to display.
a function that displays a single element
a string for displaying nodes
a string for displaying leaves
a function displaying a tree
treeToString()(node(1, [leaf(2), leaf(3)])); // -> "node(1, [leaf(2),leaf(3)])"treeToString((x) => ".".repeat(x)) (node(1, [leaf(2), leaf(3)])); // -> node(., [leaf(..),leaf(...)]) Copy
treeToString()(node(1, [leaf(2), leaf(3)])); // -> "node(1, [leaf(2),leaf(3)])"treeToString((x) => ".".repeat(x)) (node(1, [leaf(2), leaf(3)])); // -> node(., [leaf(..),leaf(...)])
Returns a string describing the tree, on a single line. This function is curried, takes a printing function for the values as first parameter, and then returns a function taking the root of a tree to display.