[Haskell] Can anyone help me with partition numbers?

Jerzy Karczmarczuk jerzy.karczmarczuk at info.unicaen.fr
Fri Nov 25 06:02:44 EST 2005


Doaitse Swierstra wrote:
> Or (since we started to do someone's  homework anyway)
> 
> generate 0 = [[]]
> generate n = [x:rest | x <- [1..n], rest <- generate (n-x)]

Unless I am misled, this will generate the *unordered* partitions,
e.g., for n=7, 64 of them, not 15.


Jerzy Karczmarczuk


More information about the Haskell mailing list