Skip to content

Instantly share code, notes, and snippets.

@tene
Created August 16, 2010 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tene/526218 to your computer and use it in GitHub Desktop.
Save tene/526218 to your computer and use it in GitHub Desktop.
sub myX(@a, @b) {
my $i = 0;
return gather {
while $i < [@a.elems, @b.elems].min {
take (@a[$i], @b[$i]);
$i++;
take (@a[$i] X @b[0..^$i]);
take (@a[0..^$i] X @b[$i]);
}
}
}
my @x := 1..*;
my @y := 1..*;
my @pairs := myX(@x, @y);
say @pairs[0..10].perl;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment