[Haskell-cafe] Building a tree?
nowgate at yahoo.com
Thu Jun 11 09:37:25 EDT 2009
Example understood. Thanks.
Is there a module for binary trees?
--- On Wed, 6/10/09, wren ng thornton <wren at freegeek.org> wrote:
From: wren ng thornton <wren at freegeek.org>
Subject: Re: [Haskell-cafe] Building a tree?
To: haskell-cafe at haskell.org
Date: Wednesday, June 10, 2009, 8:13 PM
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.
Data.Tree> let t = unfoldTree (\i -> (show i, [i`div`2..i-1]))
Data.Tree> putStr . drawTree $ t 8
-- Live well,
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe