set_symmetric_difference.pm6 (rakudo-2020.09) | : | set_symmetric_difference.pm6 (rakudo-2020.10) | ||
---|---|---|---|---|
# This test file tests the following set operators: | # This test file tests the following set operators: | |||
# (^) set symmetric difference (Texas) | # (^) set symmetric difference (Texas) | |||
# ⊖ set symmetric difference | # ⊖ set symmetric difference | |||
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), | |||
nqp::if( | nqp::if( | |||
(my \braw := b.RAW-HASH) && nqp::elems(braw), | (my \braw := b.RAW-HASH) && nqp::elems(braw), | |||
nqp::stmts( # both are initialized | nqp::stmts( # both are initialized | |||
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 | |||
skipping to change at line 228 | skipping to change at line 227 | |||
?? a (^) b.Mix | ?? a (^) b.Mix | |||
!! nqp::istype(b,Mixy) | !! nqp::istype(b,Mixy) | |||
?? a.Mix (^) b | ?? a.Mix (^) b | |||
!! nqp::istype(a,Baggy) | !! nqp::istype(a,Baggy) | |||
?? a (^) b.Bag | ?? a (^) b.Bag | |||
!! nqp::istype(b,Baggy) | !! nqp::istype(b,Baggy) | |||
?? a.Bag (^) b | ?? a.Bag (^) b | |||
!! a.Set (^) b.Set | !! a.Set (^) b.Set | |||
} | } | |||
multi sub infix:<(^)>(**@p) { | multi sub infix:<(^)>(+@p) { # also Any | |||
# positions / size in minmax info | # positions / size in minmax info | |||
my constant COUNT = 0; | my constant COUNT = 0; | |||
my constant LOWEST = 1; | my constant LOWEST = 1; | |||
my constant HIGHEST = 2; | my constant HIGHEST = 2; | |||
my constant SIZE = 3; | my constant SIZE = 3; | |||
# basic minmax for new keys | # basic minmax for new keys | |||
my $init-minmax := nqp::setelems(nqp::create(IterationBuffer),SIZE); | my $init-minmax := nqp::setelems(nqp::create(IterationBuffer),SIZE); | |||
nqp::bindpos($init-minmax,COUNT,1); | nqp::bindpos($init-minmax,COUNT,1); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 1 lines changed or added |