Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
18
Task/Hash-join/Perl-6/hash-join.pl6
Normal file
18
Task/Hash-join/Perl-6/hash-join.pl6
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
my @A = [1, "Jonah"],
|
||||
[2, "Alan"],
|
||||
[3, "Glory"],
|
||||
[4, "Popeye"];
|
||||
|
||||
my @B = ["Jonah", "Whales"],
|
||||
["Jonah", "Spiders"],
|
||||
["Alan", "Ghosts"],
|
||||
["Alan", "Zombies"],
|
||||
["Glory", "Buffy"];
|
||||
|
||||
sub hash-join(@a, &a, @b, &b) {
|
||||
my %hash{Any};
|
||||
%hash{.&a} = $_ for @a;
|
||||
([%hash{.&b} // next, $_] for @b);
|
||||
}
|
||||
|
||||
.perl.say for hash-join @A, *.[1], @B, *.[0];
|
||||
Loading…
Add table
Add a link
Reference in a new issue