> On Jul 9, 2019, at 4:36 PM, Marc Chantreux <e...@phear.org> wrote:

> i'm pretty sure that there is a shorter/more beautiful solution than
> mine so i really would like to see.
—snip—

my @players = <jean marc quentin alexandre marie-france ludo>;

# 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


# But, even more elegant is to use the native method :^)
say .join(' vs ') for @players.combinations(2);

# See https://docs.perl6.org/routine/combinations

# --
# Hope this helps,
# Bruce Gray (Util of PerlMonks)

Reply via email to