Skip to content

Commit

Permalink
Abstract Setty::BAGGIFY logic into R:Q.SET-BAGGIFY
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Jun 27, 2017
1 parent abfd7d9 commit 5fb6d67
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/core/Rakudo/QuantHash.pm
Expand Up @@ -157,6 +157,25 @@ my class Rakudo::QuantHash {
}

#--- Set/SetHash related methods

# Create an IterationSet with baggy semantics from IterationSet with
# Setty semantics.
method SET-BAGGIFY(\raw) {
nqp::stmts(
(my $elems := nqp::clone(raw)),
(my $iter := nqp::iterator($elems)),
nqp::while(
$iter,
nqp::bindkey(
$elems,
nqp::iterkey_s(nqp::shift($iter)),
Pair.new(nqp::decont(nqp::iterval($iter)),1)
)
),
$elems
)
}

method SET-IS-SUBSET($a,$b --> Bool:D) {
nqp::stmts(
nqp::unless(
Expand Down

0 comments on commit 5fb6d67

Please sign in to comment.