hello people, i have a game where every opponent much play every other ones so i implemented vs to get a list of all the matches from a list of opponents.
i'm pretty sure that there is a shorter/more beautiful solution than
mine so i really would like to see.
mine is
sub vs (@xs ( $head, *@tail ) ) {
|($head X @tail),
|(vs @tail if +@tail)
}
my @rounds = <jean marc quentin alexandre marie-france ludo >.&vs;
for @rounds -> ( $a, $b ) { say "$a vs $b" };
anyone want to share?
regards,
marc
