[email protected]
[Top] [All Lists]

[Haskell-cafe] Extracting all pruned sub trees

Subject: [Haskell-cafe] Extracting all pruned sub trees
From: Tom Hawkins
Date: Wed, 20 Jan 2010 19:09:12 +0100
I'm looking for an elegant way to generate a list of all pruned trees
where each pruned tree has one of its leaves removed.  Something like
this:

data Leaf = ...

data Tree = Leaf Leaf | Branch [Tree]

prunedSubTrees :: Tree -> [(Leaf, Tree)]    -- [(the leaf removed, the
pruned tree)]

Any suggestions?
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>