[Haskell-cafe] Building all possible element combinations from N lists.

dokondr dokondr at gmail.com
Fri Oct 26 00:11:21 CEST 2012


On Fri, Oct 26, 2012 Alex Stangl wrote:

>* *
> combos [] = [[]]
> combos ([]:ls) = combos ls
> combos ((h:t):ls) = map (h:) (combos ls) ++ combos (t:ls)
>

Excellent, thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121026/270f6ac6/attachment.htm>


More information about the Haskell-Cafe mailing list