Hash join: Difference between revisions

→‎{{header|Perl 6}}: further simplify the code
mNo edit summary
(→‎{{header|Perl 6}}: further simplify the code)
Line 1,432:
 
=={{header|Perl 6}}==
 
The <tt>.classify</tt> method returns a multimap represented as a <tt>Hash</tt> whose values are <tt>Array</tt>s.
 
{{works with|Rakudo|2016.07}}
<lang perl6>sub hash-join(@a, &a, @b, &b) {
my %hash{Any} := @b.classify(&b);
%hash{b $_}.push($_) for @b;
@a.map: -> $a {
Line 1,462:
;
 
.say for hash-join @A, *.[1], @B, *.[0];</lang>
 
{{out}}
Anonymous user