Created
February 25, 2018 07:38
-
-
Save 0racle/6be868d7ef38ca6eb2beef9b24387299 to your computer and use it in GitHub Desktop.
Gather Take Rots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub rots($list is copy) { | |
gather for ^$list { | |
$list[*] .= rotate; | |
take $list; | |
} | |
} | |
my @l = ^3; | |
my $r = rots(@l); say $r; # ([1 2 0] [2 0 1] [0 1 2]) | |
my @r = rots(@l); say @r; # [[0 1 2] [0 1 2] [0 1 2]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment