[Haskell-beginners] findSubstring deprecated

Rafael Gustavo da Cunha Pereira Pinto rafaelgcpp at gmail.com
Wed Aug 27 07:19:01 EDT 2008


Thanks!

Either KMP or BM are good for me as I will probably do a (take 1 $ matchSL
pat list)  on it.

KMP is O(n+m), right?

Regards,
Rafael

On Tue, Aug 26, 2008 at 18:43, Daniel Fischer <daniel.is.fischer at web.de>wrote:

> Am Dienstag, 26. August 2008 17:43 schrieb Rafael Gustavo da Cunha Pereira
> Pinto:
> > Two quick questions:
> >
> > 1) Is there any replacement for the (now deprecated) findSubstring
> function
> > on ByteString.Char8?
> > 2) Does it work with ByteString.Lazy.Char8?
> >
> > Best Regards,
> >
> >
> > Rafael Gustavo da Cunha Pereira Pinto
> > Electronic Engineer, MSc.
>
> Use the stringsearch package:
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stringsearch
>
> That has pretty fast stringsearch functions (usually, Boyer-Moore is faster
> than Knuth-Morris-Pratt) for strict and lazy ByteStrings.
> I'm not sure if it works on ByteString(.Lazy).Char8, too, or only on Word8
> ByteStrings, but it would be trivial to adapt, just change the import.
>
> There's one thing to be aware of, however, if there are overlapping
> occurences
> of the searched-for string, KMP reports only the first of their indices, BM
> all.
>
> Maybe we should complete it and also add search&replace functions?
>
> Cheers,
> Daniel
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20080827/bead38d6/attachment.htm


More information about the Beginners mailing list