
12 Jun
2006
12 Jun
'06
7:44 p.m.
Hi
beginsWith [] [] = True beginsWith _ [] = True beginsWith [] _ = False beginsWith (a:aa) (b:bb) | a == b = aa `beginsWith` bb | otherwise = False
I used to have this in my library then I discovered isPrefixOf :) (or flip isPrefixOf, I think in this case)
endsWith a b = beginsWith (reverse a) (reverse b) ditto, isSuffixOf
Thanks Neil