List rooted trees: Difference between revisions

Content added Content deleted
m (→‎{{header|Haskell}}: an if then else to a guard expression)
Line 411: Line 411:
let root = rootLabel tree
let root = rootLabel tree
nest = subForest tree
nest = subForest tree
in Node
forest
root
| root == snd tplIP = nest ++ [Node (fst tplIP) []]
(if root == snd tplIP
| otherwise = (`go` tplIP) <$> nest
then nest ++ [Node (fst tplIP) []]
in Node root forest
else (`go` tplIP) <$> nest)


depthSortedTree
depthSortedTree