7 Nov
2001
7 Nov
'01
4:19 a.m.
Hi, Im studying for an exam in Haskell program and for practice we have been given exercises to complete on our own. The answers have not been put up on the website either. So i was hoping for some help with this little program here. The idea is to be able to substitute the first occurrence of a given subsequence in a list with another subsequence. The problem im not sure how to compare the lists for equality. Here the is what i have so far..... substitute :: Eq a => [a] -> [a] -> [a] -> [a] substitute _ [] _ = [] substitute ys (x:xs) zs | ys == x = zs:xs | otherwise = x:substitute ys xs zs Any help would be greatly appreciated. Thanks Stephanie