develooper Front page | perl.perl6.users | Postings from July 2019

[golf?] list of matches

Thread Next
Marc Chantreux
July 9, 2019 21:36
[golf?] list of matches
Message ID:
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?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About