Jump to content

Ramsey's theorem: Difference between revisions

m
→‎{{header|Perl 6}}: explicit .Array to allow iterating over 'combinations' output
m (→‎{{header|Perl 6}}: a 'flat' to restore correct operation)
m (→‎{{header|Perl 6}}: explicit .Array to allow iterating over 'combinations' output)
Line 550:
 
=={{header|Perl 6}}==
{{Works with|rakudo|20162017.0801}}
<lang perl6>my @a = [ 0 xx 17 ] xx 17;
@a[$_;$_] = '-' for ^17;
Line 560:
.say for @a;
 
for combinations(17,4).Array -> $quartet {
my $links = [+] $quartet.combinations(2).map: -> [$i;,$j] { @a[$i;$j] }
die "Bogus!" unless 0 < $links < 6;
}
2,392

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.