[Haskell-cafe] Combinations

Henning Thielemann lemming at henning-thielemann.de
Tue Jun 6 10:46:46 EDT 2006


On Tue, 6 Jun 2006, Udo Stenzel wrote:

> developer at imaginando.net wrote:
>> I need a functions which takes as argument a list of lists like this one:
>>
>> [[1,2],[3],[4]]
>>
>> and gives me a list of list with all the possible combinations like this one:
>>
>> [[1,3,4],[2,3,4]]
>
> sequence


I see, it is just
    sequence  ==  foldr (liftM2 (:)) (return [])


More information about the Haskell-Cafe mailing list