On Tuesday 25 May 2010 10:44:57, Ivan Lazar Miljenovic wrote:
> Daniel Fischer <daniel.is.fisc...@web.de> writes:
> > On Tuesday 25 May 2010 08:14:13, Ivan Miljenovic wrote:
> >> On 25 May 2010 16:12, Magicloud Magiclouds
> >>
> >> <magicloud.magiclo...@gmail.com> wrote:
> >> > Yes, this code works with a little hack. Thank you.
> >>
> >> I'm scared to ask: what pray tell is this little hack?
> >
> > Looking at it again, probably making it work at all, because I never
> > consumed the "Log for " lines, so produced an infinite list of empty
> > lists
> >
> > :-/
>
> Oh, yeah, I've done that before (with custom chunking functions, etc.).

Who hasn't?

>
> Just so you know, the split package might already have a function to do
> what you want...

Sort of. Not one function, but the building blocks:

import Data.List (isPrefixOf)
import Data.List.Split

msplit = split (keepDelimsL $ whenElt ("Log for " `isPrefixOf`))

I think. But who looks at API docs in the dead of the night when cooking up 
the function seems so easy :)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to