
17 May
2005
17 May
'05
11:44 a.m.
You can get efficiency, the desired data, and deal with infinite strings by using a function that is like 'inits' but which returns the initial strings in reversed order.
reversed_inits = scanl (flip (:)) "" find (isPrefixOf (reverse "needle")) (reversed_inits "haystack")
If I may ask for curiosity's sake, how much string data are we talking about here? Is it practical to process a serious volume of data as [Char]? Donn Cave, donn@drizzle.com