[Haskell-beginners] Does Haskell have a function that creates a list corresponding to the nodes in a tree, from the leaf node to the root node?
David Place
d at vidplace.com
Sat Jun 11 15:42:33 CEST 2011
Hi, Roger.
In functional algorithms using trees, nodes usually don't have parent pointers. This would make efficient update impossible.
____________________
David Place
Owner, Panpipes Ho! LLC
http://panpipesho.com
d at vidplace.com
On Jun 11, 2011, at 8:28 AM, Costello, Roger L. wrote:
> Hi Folks,
>
> I am implementing the following function in another language. I want to see if Haskell already has a function that does this; if so, I want to use the Haskell function name rather than inventing my own.
>
> Here is the function that I am implementing: consider a tree data structure. I pass to the function one of its leaf nodes. The function returns a list containing that leaf node as the first element of the list, the leaf node's parent as the second element of the list, ..., the tree's root node as the n'th element of the list. (The list consists of all the nodes from the leaf node to the root node)
>
> Does Haskell have a function that does this?
>
> If not, and you were to define a function for this, what name would you give to the function?
>
> /Roger
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list