Skip to content

Commit

Permalink
Add msubset and msuperset operators, clean up a glitch in infix:<(&)>.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Jun 7, 2012
1 parent 014fec3 commit 556574c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/CORE.setting
Expand Up @@ -2099,7 +2099,7 @@ only sub infix:<(|)>($a, $b) is equiv(&infix:<X>) { $a ∪ $b }
proto sub infix:<∩>($, $ --> Set) is equiv(&infix:<X>) {*}
multi sub infix:<∩>(Any $a, Any $b --> Set) { Set($a) Set($b) }
multi sub infix:<∩>(Set $a, Set $b --> Set) { Set.new: $a.keys.grep: -> $k { ?$b{$k} } }
only sub infix:<(&)>($a, $b --> Set) is equiv(&infix:<X>) { $a $b }
only sub infix:<(&)>($a, $b) is equiv(&infix:<X>) { $a $b }
proto sub infix:<(-)>($, $ --> Set) is equiv(&infix:<X>) {*}
multi sub infix:<(-)>(Any $a, Any $b --> Set) { Set($a) (-) Set($b) }
Expand Down Expand Up @@ -2255,6 +2255,14 @@ multi sub infix:<⊎>(Any $a, Any $b --> Bag) { bag($a) ⊎ bag($b) }
multi sub infix:<⊎>(Bag $a, Bag $b --> Bag) { bag((set($a) set($b)).map({ ; $_ => $a{$_} + $b{$_} })) }
only sub infix:<(+)>($a, $b --> Bag) is equiv(&infix:<X>) { $a $b }
proto sub infix:<≼>($, $ --> Bool) is equiv(&infix:<==>) {*}
multi sub infix:<≼>(Any $a, Any $b --> Bool) { bag($a) bag($b) }
multi sub infix:<≼>(Bag $a, Bag $b --> Bool) { so all $a.keys.map({ $a{$_} <= $b{$_} }) }
proto sub infix:<≽>($, $ --> Bool) is equiv(&infix:<==>) {*}
multi sub infix:<≽>(Any $a, Any $b --> Bool) { bag($a) bag($b) }
multi sub infix:<≽>(Bag $a, Bag $b --> Bool) { so all $b.keys.map({ $b{$_} <= $a{$_} }) }
class KeyBag does Associative does Baggy {
has Int %!elems; # should be UInt
Expand Down

0 comments on commit 556574c

Please sign in to comment.