Balanced ternary: Difference between revisions

m
→‎{{header|Perl 6}}: group input to 'sort'
m (→‎{{header|Perl 6}}: group input to 'sort')
Line 2,901:
</pre>
=={{header|Perl 6}}==
{{Works with|rakudo|2016-112017.01}}
<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));
}
2,392

edits