[Haskell-cafe] Pruning the tree

paolo veronelli paolo_veronelli at yahoo.it
Sun Jul 4 14:24:43 EDT 2004


Now I have my infinite tree inf

t =Leaf "1"

treeGrower :: Tree String-> Tree String
treeGrower (Leaf a )= treeGrower (Fork (Leaf (a++"1")) (Leaf (a++"2")))
treeGrower (Fork l r)  = Fork (treeGrower l) (treeGrower r)

data Tree a = Fork (Tree a) (Tree a) | Leaf a deriving Show

inf=treeGrower t

I'd like to prune it to a level to have a show of a piece
like
piece= prune 5 inf

How prune is to be coded ??
Thanks Paolino



More information about the Haskell-Cafe mailing list