Balanced ternary: Difference between revisions
m
→{{header|Perl 6}}: group input to 'sort'
SqrtNegInf (talk | contribs) m (→{{header|Perl 6}}: group input to 'sort') |
|||
Line 2,901:
</pre>
=={{header|Perl 6}}==
{{Works with|rakudo|
<lang perl6>class BT {
has @.coeff;
Line 2,938:
multi infix:<+> (BT $x, BT $y) {
my ($b,$a) = sort +*.coeff, ($x, $y);
BT.new: coeff => carry ($a.coeff Z+ |$b.coeff, |(0 xx $a.coeff - $b.coeff));
}
|