[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?
Costello, Roger L.
costello at mitre.org
Sat Jun 11 14:28:00 CEST 2011
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?
More information about the Beginners