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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to