"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core.c/set_addition.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_addition.pm6  (rakudo-2020.09):set_addition.pm6  (rakudo-2020.10)
# This file implements the following set operators: # This file implements the following set operators:
# (+) baggy addition (ASCII) # (+) baggy addition (ASCII)
# ⊎ baggy addition # ⊎ baggy addition
proto sub infix:<(+)>(|) is pure {*} proto sub infix:<(+)>(|) is pure {*}
multi sub infix:<(+)>() { bag() } multi sub infix:<(+)>() { bag() }
multi sub infix:<(+)>(Bag:D \a) { a } multi sub infix:<(+)>(Bag:D \a) { a }
multi sub infix:<(+)>(Mix:D \a) { a } multi sub infix:<(+)>(Mix:D \a) { a }
multi sub infix:<(+)>(MixHash:D \a) { a.Mix } multi sub infix:<(+)>(MixHash:D \a) { a.Mix }
multi sub infix:<(+)>(Any \a) { a.Bag }
multi sub infix:<(+)>(Setty:D \a, QuantHash:D \b) { multi sub infix:<(+)>(Setty:D \a, QuantHash:D \b) {
nqp::if( nqp::if(
(my \araw := a.RAW-HASH) && nqp::elems(araw), (my \araw := a.RAW-HASH) && nqp::elems(araw),
nqp::if( # elems on left nqp::if( # elems on left
(my \braw := b.RAW-HASH) && nqp::elems(braw), (my \braw := b.RAW-HASH) && nqp::elems(braw),
nqp::stmts( # elems on both sides nqp::stmts( # elems on both sides
(my \elems := Rakudo::QuantHash.SET-BAGGIFY(araw)), (my \elems := Rakudo::QuantHash.SET-BAGGIFY(araw)),
nqp::create( nqp::create(
nqp::if( nqp::istype(b,Mixy), a.WHAT.Mixy, a.WHAT.Baggy ) nqp::if( nqp::istype(b,Mixy), a.WHAT.Mixy, a.WHAT.Baggy )
skipping to change at line 163 skipping to change at line 162
infix:<(+)>(a.Baggy, b.Bag(:view)) # :view is implementation-detail infix:<(+)>(a.Baggy, b.Bag(:view)) # :view is implementation-detail
), ),
nqp::if( nqp::if(
nqp::istype(a,Mixy) || nqp::istype(b,Mixy), nqp::istype(a,Mixy) || nqp::istype(b,Mixy),
infix:<(+)>(a.Mix, b.Mix(:view)), # :view is implementation-detail infix:<(+)>(a.Mix, b.Mix(:view)), # :view is implementation-detail
infix:<(+)>(a.Bag, b.Bag(:view)) # :view is implementation-detail infix:<(+)>(a.Bag, b.Bag(:view)) # :view is implementation-detail
) )
) )
} }
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.Bag
}
} }
# U+228E MULTISET UNION # U+228E MULTISET UNION
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)