hello Bruce;

> # Elegant using the "cat-ears" range modifiers in Perl 6:
> for     0  ..^ @players.end -> \i {
>     for i ^..  @players.end -> \j {
>         say @players[i,j].join(' vs ');
>     }
> }
> # See https://docs.perl6.org/type/Range

i played around it and got:

  my @players = <jean marc quentin alexandre >;
  my @rounds =
    gather for ^@players -> \p
      { take @players[p,$_] for p^..^@players };
  for @rounds -> ( $a, $b ) { "$a vs $b".say }

> say .join(' vs ') for @players.combinations(2);
> # See https://docs.perl6.org/routine/combinations

i knew there will be something like that ... but didn't find it!
thank you very much.

regards
marc

Reply via email to