Tree unfold (source code)

= Tree unfold
{title2=`unfoldTree :: (s -> Maybe (s,a,s)) -> s -> Tree a`}

Expand a seed by a function returning either no node or a left seed, root label and right seed. Recursively expanding the two seeds produces a binary tree. A finite ascending <list> split about its midpoint supplies an unfold into a <balanced binary tree> that is a <binary search tree>.