
24 Oct
2006
24 Oct
'06
8:04 a.m.
Gah! Brain AWOL. I'm surprised no-one picked me up on that. Why didn't I use:
splitAtMb n [] = Nothing splitAtMb n l = Just $ splitAt n l
Actually, I've some code lying around doing exactly this (but without the padding ;)), written with the coalgebra inlined: split n = unfoldr $ \xs -> case xs of [] -> Nothing _ -> Just (splitAt n xs) Cheers, Stefan