Prelude function suggestions
t.zielonka at students.mimuw.edu.pl
Thu Jul 29 07:39:47 EDT 2004
On Thu, Jul 29, 2004 at 12:40:08PM +0200, Martin Sjögren wrote:
> I often use an even more generic function:
> splitter :: ([a] -> (b,[a])) -> [a] -> [b]
> splitter _  = 
> splitter f xs = b : splitter f rest
> where (b,rest) = f xs
> The name might not be ideal, but the general mechanics of it is pretty nice.
Have you looked at List.unfoldr? It's even more general.
unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
.signature: Too many levels of symbolic links
More information about the Libraries