[Haskell-cafe] Text search

Donn Cave donn at drizzle.com
Tue May 17 11:44:34 EDT 2005


> 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 at drizzle.com



More information about the Haskell-Cafe mailing list