"Max cs" <[email protected]> wrote: > hi all, not sure if there is someone still working during holiday > like me : ) > > I got a little problem in implementing some operations on tree. > > suppose we have a tree date type defined: > > data Tree a = Leaf a | Branch (Tree a) (Tree a) > > I want to do a concatenation on these tree just like the concat on > list. Anyone has idea on it? or there are some existing > implementation? > The semantics of tree concat vary, depending on what type of tree you want to have. In the simplest case, it's unbalanced, so you can just do
concat :: Tree a -> Tree a -> Tree a concat x y = Branch x y if, on the other hand, you want to keep the tree balanced, or sorted, or whatever, things get more involved. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
