[Haskell-cafe] Building a tree?

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 10 20:11:34 EDT 2009


On Wed, 10 Jun 2009, michael rice wrote:

> Here's a function from Data.Tree:
> 
> unfoldTree :: (b -> (a, [b])) -> b -> Tree a
> Build a tree from a seed value
> 
> Could someone please give me a brief example of usage.

unfoldTree (\n -> (chr (n + ord 'a'), replicate n (n-1))) 3


Or did you expect a "real world" example? :-)


More information about the Haskell-Cafe mailing list