Gracjan Polak <[EMAIL PROTECTED]> writes:

> find (isSuffixOf "needle") (inits "haystack")

Hmm...

While the result isn't exactly the same, I suspect 
using isPrefixOf and tails would be more efficient.

> This one is beautiful, but not very practical.

Unless you have very repetitive data and/or tiny alphabet, it is
actually quite efficient, as the expected length of prefixes that need
to be checked before a mismatch can be determined is small.

At least, I was unable to beat it with my (feeble attempts at) BM or
KMP implementations.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to