Summarize and say sequence: Difference between revisions

m
m (→‎{{trans|Racket}}: Drop @(do ...))
m (→‎{{header|Perl 6}}: various fixes)
Line 2,506:
 
=={{header|Perl 6}}==
{{Works with|rakudo|2016.11}}
 
<lang perl6>my @list;
my $longest = 0;
Line 2,513 ⟶ 2,515:
next unless $m ~~ /0/; # seed must have a zero
my $j = join '', $m.comb.sort;
next if %seen.exists({$j)}:exists; # already tested a permutation
%seen{$j} = '';
my @seq := converging($m);
Line 2,531 ⟶ 2,533:
 
for @list -> $m {
say "Seed Value(s): ", my $seeds = ~permutations($m).uniqunique.grep( { .substr(0,1) != 0 } );
my @seq := converging($m);
my %elems;
Line 2,549 ⟶ 2,551:
my $this = $string.substr(0,$idx)~$string.substr($idx+1);
my $char = substr($string, $idx,1);
@perms.push( |permutations( $this, join '', $sofar, $char ) ) ;
}
return @perms;
2,392

edits