"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core.c/set_intersection.pm6" between
rakudo-2020.09.tar.gz and rakudo-2020.10.tar.gz

About: Rakudo is a compiler for the Raku Pogramming Language (formerly known as Perl 6).

set_intersection.pm6  (rakudo-2020.09):set_intersection.pm6  (rakudo-2020.10)
# This file implements the following set operators: # This file implements the following set operators:
# (&) intersection (ASCII) # (&) intersection (ASCII)
# ∩ intersection # ∩ intersection
proto sub infix:<(&)>(|) is pure {*} proto sub infix:<(&)>(|) is pure {*}
multi sub infix:<(&)>() { set() } multi sub infix:<(&)>() { set() }
multi sub infix:<(&)>(QuantHash:D \a) { a } # Set/Bag/Mix multi sub infix:<(&)>(QuantHash:D \a) { a } # Set/Bag/Mix
multi sub infix:<(&)>(Any \a) { a.Set } # also for Iterable/Map
multi sub infix:<(&)>(Setty:D \a, Setty:D \b) { multi sub infix:<(&)>(Setty:D \a, Setty:D \b) {
nqp::if( nqp::if(
(my $araw := a.RAW-HASH) && nqp::elems($araw) (my $araw := a.RAW-HASH) && nqp::elems($araw)
&& (my $braw := b.RAW-HASH) && nqp::elems($braw), && (my $braw := b.RAW-HASH) && nqp::elems($braw),
nqp::stmts( # both have elems nqp::stmts( # both have elems
nqp::if( nqp::if(
nqp::islt_i(nqp::elems($araw),nqp::elems($braw)), nqp::islt_i(nqp::elems($araw),nqp::elems($braw)),
nqp::stmts( # a smallest, iterate over it nqp::stmts( # a smallest, iterate over it
(my $iter := nqp::iterator($araw)), (my $iter := nqp::iterator($araw)),
skipping to change at line 150 skipping to change at line 149
!! nqp::isconcrete(b) !! nqp::isconcrete(b)
?? nqp::istype(b,Mixy) ?? nqp::istype(b,Mixy)
?? a.Mix (&) b ?? a.Mix (&) b
!! nqp::istype(b,Baggy) !! nqp::istype(b,Baggy)
?? a.Bag (&) b ?? a.Bag (&) b
!! a.Set (&) b.Set !! a.Set (&) b.Set
!! a (&) b.Set !! a (&) b.Set
!! a.Set (&) b !! a.Set (&) b
} }
multi sub infix:<(&)>(**@p) { multi sub infix:<(&)>(+@p) { # also Any
my $result = @p.shift; my $result := @p.shift;
$result = $result (&) @p.shift while @p; if @p {
$result $result := $result (&) @p.shift while @p;
$result
}
else {
$result.Set
}
} }
# U+2229 INTERSECTION # U+2229 INTERSECTION
my constant &infix:<∩> := &infix:<(&)>; my constant &infix:<∩> := &infix:<(&)>;
# vim: expandtab shiftwidth=4 # vim: expandtab shiftwidth=4
 End of changes. 2 change blocks. 
5 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)