Am 05.01.2012 13:04, schrieb Steve Horne:
[...]
I was going to accuse you of cheating - who says there's a spare value
to use? - but you seem to be using Maybe, so well played.
You're also using unfoldr, which I really must play with a bit - I don't
really have a feel for how unfolding works ATM.
You may prefer another variant of unfoldr (without Maybe):
unfoldr' :: ([b] -> (a, [b])) -> [b] -> [a]
unfoldr' f l = if null l then [] else
let (a, r) = f l in a : unfoldr' f r
split' :: (a -> Bool) -> (a -> Bool) -> [a] -> [[a]]
split' e p = unfoldr' $ break' e p
C.
P.S. my break' function fails for "\r\r\n" (as the first char escapes
the second and the second no longer the third)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe