Imaginary base numbers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: Remove checks for things that can never happen. Reword exposition a bit.) |
Thundergnat (talk | contribs) m (→{{header|Perl 6}}: slight efficiency tweak) |
||
Line 335: | Line 335: | ||
sub zip (Str $a, Str $b) { |
sub zip (Str $a, Str $b) { |
||
my $l = '0' x ($a.chars |
my $l = '0' x ($a.chars - $b.chars).abs; |
||
([~] flat ($a~$l).comb Z flat ($b~$l).comb).subst(/ '0'+ $ /, '') || '0' |
([~] flat ($a~$l).comb Z flat ($b~$l).comb).subst(/ '0'+ $ /, '') || '0' |
||
} |
} |