At 10:27 16/05/05 +0200, Gracjan Polak wrote:
Hi,
Simple question: I need a function that matches string in another string.
Something like:
find (isSuffixOf "needle") (inits "haystack")
This one is beautiful, but not very practical. Could anybody point me to
some haskell library that does some searching, using KMP for example?
[[
import List
foo = isPrefixOf (reverse "needle") (reverse "haystack with needle")
bar = isPrefixOf (reverse "needle") (reverse "haystack with pins")
]]
Seems to work. And (by inspection) is linear in size of haystack.
#g
------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe