[Haskell-cafe] Nested Lists
VoidEx
voidex at yandex.ru
Thu Jun 4 14:21:15 EDT 2009
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090604/0d775b88/attachment.html
More information about the Haskell-Cafe
mailing list