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
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to