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
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
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