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

Jake McArthur jake.mcarthur at gmail.com
Fri Oct 26 00:34:53 CEST 2012


I golfed a bit. :)

    sequence <=< filterM (const [False ..])

On Thu, Oct 25, 2012 at 6:11 PM, dokondr <dokondr at gmail.com> wrote:
>
> 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!
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list