<?xml version="1.0" encoding="windows-1252"?>
<node id="78346" title="Re: (Golf as well): List of Partitions" created="2001-05-06 12:54:49" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="53423">
Masem</author>
<data>
<field name="doctext">
Here's one that is 65 characters, returns as array of arrays, but has duplicates (though the orders are unique).
&lt;CODE&gt;
sub P {
$_[0]?map{my$c=$_;map[$c,@$_],P($_[0]-$c)}(1..$_[0]):[]
}
&lt;/CODE&gt;
&lt;B&gt;Update&lt;/B&gt;: Same thing, but avoids repetitions:  Total
chars: 96
&lt;CODE&gt;
sub P {
my$b=$_[1]||$_[0];
$_[0]?map{my$c=$_;map[$c,@$_],P($_[0]-$c,$c)}grep{$_&lt;=$b}(1..$_[0]):[]
}
&lt;/CODE&gt;
&lt;HR&gt;
&lt;I&gt;
Dr. Michael K. Neylon - &lt;a href="mailto:mneylon-pm@masemware.com"&gt;mneylon-pm@masemware.com&lt;/a&gt;
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
&lt;/I&gt;</field>
<field name="root_node">
78334</field>
<field name="parent_node">
78334</field>
</data>
</node>
