http://www.perlmonks.org?node_id=78343


in reply to Re: (Golf as well): List of Partitions
in thread (Golf as well): List of Partitions

Cute idea, but your output from P(11) is..ambiguous.

And P(12) has the incorrect "1011" entry for 10, 11.

UPDATE
Nice improvement. It can indeed be compressed. Here is 74 characters:

sub P{ my$n=pop;[$n],map{my$i=$_;grep{!grep$_>$i,@$_}map[$i,@$_],P($n-$i)}1.. +$n-1 }