Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Hash-join/Raku/hash-join.raku
Normal file
25
Task/Hash-join/Raku/hash-join.raku
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
sub hash-join(@a, &a, @b, &b) {
|
||||
my %hash := @b.classify(&b);
|
||||
|
||||
@a.map: -> $a {
|
||||
|(%hash{$a.&a} // next).map: -> $b { [$a, $b] }
|
||||
}
|
||||
}
|
||||
|
||||
my @A =
|
||||
[27, "Jonah"],
|
||||
[18, "Alan"],
|
||||
[28, "Glory"],
|
||||
[18, "Popeye"],
|
||||
[28, "Alan"],
|
||||
;
|
||||
|
||||
my @B =
|
||||
["Jonah", "Whales"],
|
||||
["Jonah", "Spiders"],
|
||||
["Alan", "Ghosts"],
|
||||
["Alan", "Zombies"],
|
||||
["Glory", "Buffy"],
|
||||
;
|
||||
|
||||
.say for hash-join @A, *[1], @B, *[0];
|
||||
Loading…
Add table
Add a link
Reference in a new issue