You can also try this:

 

bunch n f = takeWhile (not . null) . unfoldr (Just . (f *** id) . splitAt n)

> (bunch 8 . bunch 4 . bunch 2) id [1..16]

 

Any way, it's not possible to take list [8, 4, 2], because it's length need
to be known at compile time.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to