I wrote this code and Can it be less?
[2,4,5]list is sub list of [3,7,2,4,5,9] list and return True but not
of[3,7,4,2,5,9] list ; return False
sublist :: Eq a => [a] -> [a] -> Bool
sublist [] _ = True
sublist (_:_) [] = False
sublist (x:xs) (y:ys)
| x == y = if isEqual (x:xs) (y:ys) == False
then sublist (x:xs) ys
else True
| otherwise = sublist (x:xs) ys
isEqual :: Eq a => [a] -> [a] -> Bool
isEqual [] _ = True
isEqual (_:_) [] = False
isEqual (x:xs) (y:ys)
| x==y = isEqual xs ys
| otherwise = False
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe