definition:
|
getTreesNodeName :: Int -> [Tree _] -> String
getTreesNodeName _ [] = error "getTreesNodeName: nothing selected" -- should not occur
getTreesNodeName n (Leaf name _ : trees) =
if n==0 then name
else getTreesNodeName (n-1) trees
getTreesNodeName n (Node t v subtrees : trees) =
if n==0 then t
else let l = length (tree2strings 0 (Node t v subtrees)) in
if n < l
then getTreesNodeName (n-1) subtrees
else getTreesNodeName (n-l) trees
|
demand:
|
argument 2
|
deterministic:
|
deterministic operation
|
documentation:
|
-- get name of selected node in the tree list:
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_,{:}) |-> _}
|
name:
|
getTreesNodeName
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
Prelude.Int -> [Tree a] -> String
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|