[Haskell-cafe] Help please

Ryan Bloor ryanbloor at hotmail.com
Sun Nov 4 06:59:33 EST 2007


hello, I am struggling with rose trees
in Haskell. I need to construct an algebraic data type definition for
"family trees" and a representation of the tree below. Also I need to
construct a function that returns a persons children when given both a
family tree and a name. The same is needed but for a getParents
function. 

                                                    1

 

                                  2                 3               4

                           5     6     7                   8    9    10     11

 

That is the rose tree that I seek. Where each number above is equivalent to (String, String) 

 

Data Tree a = Empty | Leaf a | Node a [(Tree a)]

 

example :: Tree (String, String) 

example = Node ("a","b")     -- root node

                    [ ...............define tree.........................] -- end of tree


_________________________________________________________________
100’s of Music vouchers to be won with MSN Music
https://www.musicmashup.co.uk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071104/79daaa84/attachment-0001.htm


More information about the Haskell-Cafe mailing list