Reputation: 53
I have got something like this
data Tree a = Null |Nod (Tree a) a (Tree a)
What I want to do is create a function merge that will merge two given trees and the root of the final tree will be always the root of the left leaf of the first tree. The purpose is to remove the left leaf while doing so.
Upvotes: 0
Views: 2012
Reputation: 65620
Something like:
mergeTrees Null t2 = t2
mergeTrees (Nod left value right) t2 = Nod (mergeTrees left t2) value right
Upvotes: 1