Re: [Haskell-cafe] Rose Tree
I think it's not at all clear what you're asking for here. can you give an example inputs and outputs you'd expect? It looks like you're trying to implement some kind of dictionary or something? Also, have you looked at the library Data.Tree? It might be useful for you. On 11/3/07, Ryan Bloor [EMAIL PROTECTED] wrote: Hello, I need help... I am having trouble with rose trees. 1 2 3 4 5 6 7 8910 11 That is the rose tree that I seek. Data Tree a = Empty | Leaf a | Node a [(Tree a)] example :: Tree (String, String) example = Node (a,b) -- root node [ ] -- end of tree What I want to do is create two functions that return either the children or parents of a given input, here a String. String - Tree - [String] I think Play Movie Mash-up and win BIG prizes! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Rose Tree
Ryan Bloor: Data Tree a = Empty | Leaf a | Node a [(Tree a)] The Leaf constructor seems superfluous to me. Any (Leaf x) value is equivalent to (Node x []). So I rather just have data Tree a = Empty | Node a [Tree a] which will mean less work for your task of writing processing functions, too. Kalman -- Get a free email account with anti spam protection. http://www.bluebottle.com/tag/2 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Rose Tree
Hello, I need help... I am having trouble with rose trees. 1 2 3 4 5 6 7 8910 11 That is the rose tree that I seek. Data Tree a = Empty | Leaf a | Node a [(Tree a)] example :: Tree (String, String) example = Node (a,b) -- root node [ ] -- end of tree What I want to do is create two functions that return either the children or parents of a given input, here a String. String - Tree - [String] I think _ The next generation of MSN Hotmail has arrived - Windows Live Hotmail http://www.newhotmail.co.uk___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe