First i want to thank all the persons who responded me yesterday to help me. Thanks! I am so happy with with your friendliness.
So i have other beginners question:
Now i want a improved version of my intercalate. Now i want to call a function with two [t][t] and obtain another one which have only
even elements, even because:
- [1,2,3,3,4][6] and the ouput [1,6]
- [1,2,3,4][5,6,7] output [1,5,2,6,3,7]
I tried it:
intercalate :: (Eq t) => [t] -> [t] -> [t]
intercalate (x:xs) (y:ys)
| xt == [] = []
| yt == [] = []
| otherwise = x : y : intercalate xs ys
where xt=(x:xs)
yt=(y:ys)
but i get nice error
*Main> intercalate [1][6]
[1,6*** Exception: baby.hs:(2,1)-(5,51): Non-exhaustive patterns in function intercalate
*Main>
(yes...the file's name is baby.hs)
Thanks in advance! (: (: (:
(: (: