[Haskell-cafe] about the concatenation on a tree

Emil Axelsson emax at chalmers.se
Wed Dec 31 10:30:14 EST 2008


I'm not working, but still checking mail.

If you don't care about balancing the tree or the order of elements, you can 
just use

   Branch :: Tree a -> Tree a -> Tree a

as a concatenation operator. Check with GHCi to see that the Branch constructor 
actually has the above type.

/ Emil



Max cs skrev:
> 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?
>  
> Thank you and Happy New Year!
>  
> regards,
> Max
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list