Why this doesnt work?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why this doesnt work?

guidera
this is the code:

------------union 2 lists
union [] l = []
union l [] = []
union (a:x)(b:y) | a==b = concattt a b
               |otherwise = union x y

------------concat 2 lists
concattt l1 l2 = (l1++l2)

I believe the error is when trying to concat a and b.
The thing is the function concat can be used to concat 2 lists so why cant I concat a and b ?!

I know there is a fuction concat pre defined to do this but I dont want to use it. I want to create my own.
So if someone can help I would be very glad. if possible pls show me how to concat a and b having built my own function, Ty all =) and yes , I am new to Haskell.