Re: [Haskell-cafe] Extracting all pruned sub trees

2010-01-21 Thread Mark Lentczner
On Jan 20, 2010, at 10:09 AM, Tom Hawkins wrote: 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. This turned out to be a thornier problem than I thought! (pun intended) -- | A simple Tree type. data Tree a = Leaf a

Re: [Haskell-cafe] Extracting all pruned sub trees

2010-01-21 Thread Tom Hawkins
On Thu, Jan 21, 2010 at 4:07 PM, Mark Lentczner ma...@glyphic.com wrote: On Jan 20, 2010, at 10:09 AM, Tom Hawkins wrote: 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. This turned out to be a thornier problem than I

[Haskell-cafe] Extracting all pruned sub trees

2010-01-20 Thread Tom Hawkins
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