Skip to content

Commit

Permalink
Add default method for Set, KeySet, Bag, and KeyBag.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed May 14, 2013
1 parent ba63d9a commit 009f999
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/CORE.setting
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,7 @@ my enum Order (:Increase(-1), :Same(0), :Decrease(1));
class Set does Associative {
has Bool %!elems;
method default { False }
method keys { %!elems.keys }
method values { %!elems.values }
method elems returns Int { %!elems.elems }
Expand Down Expand Up @@ -2270,6 +2271,7 @@ only sub infix:<⊅>($a, $b --> Bool) is equiv(&infix:<==>) { $a !⊃ $b }
class KeySet does Associative {
has Bool %!elems;
method default { False }
method keys { %!elems.keys }
method values { %!elems.values }
method elems returns Int { %!elems.elems }
Expand Down Expand Up @@ -2320,6 +2322,7 @@ role Baggy { Any }
class Bag does Associative does Baggy {
has Int %!elems; # should be UInt
method default { 0 }
method keys { %!elems.keys }
method values { %!elems.values }
method elems returns Int { [+] self.values }
Expand Down Expand Up @@ -2394,6 +2397,7 @@ multi sub infix:<≽>(Baggy $a, Baggy $b --> Bool) { so all $b.keys.map({ $b{$_}
class KeyBag does Associative does Baggy {
has Int %!elems; # should be UInt
method default { 0 }
method keys { %!elems.keys }
method values { %!elems.values }
method elems returns Int { [+] self.values }
Expand Down

0 comments on commit 009f999

Please sign in to comment.