Railway circuit: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: use False/True instead of 0/1) |
SqrtNegInf (talk | contribs) m (→{{header|Raku}}: Use True instead of '1', remove single-use variable) |
||
Line 1,313: | Line 1,313: | ||
sub digits($n!, $base!, $pad=0) { |
sub digits($n!, $base!, $pad=0) { |
||
my @output = $n.base($base).comb.reverse; |
my @output = $n.base($base).comb.reverse; |
||
@output.append: 0 xx ($pad - +@output) if $pad > +@output; |
|||
return @output |
return @output |
||
} # rough port of https://docs.julialang.org/en/v1/base/numbers/#Base.digits |
} # rough port of https://docs.julialang.org/en/v1/base/numbers/#Base.digits |
||
Line 1,320: | Line 1,320: | ||
sub circularsymmetries(@c) { (0..^+@c).map: {rotate @c, $_} } |
sub circularsymmetries(@c) { (0..^+@c).map: {rotate @c, $_} } |
||
my @allsym = |(circularsymmetries turns), |(circularsymmetries -«turns); |
my @allsym = |(circularsymmetries turns), |(circularsymmetries -«turns); |
||
%infound{$_.Str} = |
%infound{$_.Str} = True for @allsym; |
||
return @allsym.max |
return @allsym.max |
||
} |
} |