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 }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re (tilly) 2: (Golf as well): List of Partitions
by danger (Priest) on May 07, 2001 at 00:52 UTC | |
by tilly (Archbishop) on May 07, 2001 at 01:04 UTC | |
by jynx (Priest) on May 07, 2001 at 09:39 UTC | |
by tilly (Archbishop) on May 07, 2001 at 15:35 UTC |
In Section
Seekers of Perl Wisdom