[Haskell-beginners] partition a list in all possible ways
I. J. Kennedy
jack at realmode.com
Tue Apr 26 20:10:37 CEST 2011
I'm looking for a function [a] -> [[[a]]] that will partition a list into
non-empty pieces in all possible ways.
For example
f [1,2,3,4] = [[[1],[2],[3],[4]], [[1],[2],[3,4]], [[1],[2,3],[4]],
[[1],[2,3,4]], [[1,2],[3],[4]], [[1,2],[3,4]], [[1,2,3],[4]], [[1,2,3,4]]]
Perhaps this is a well-known function to experts, but not to me. Hoogle
doesn't seem to have anything with this signature.
Thanks,
Jack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110426/e29bab9b/attachment.htm>
More information about the Beginners
mailing list