Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
We need Real to support Inf/-Inf right now
  • Loading branch information
lizmat committed Apr 13, 2014
1 parent dca5394 commit 2a30681
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/core/Bag.pm
@@ -1,12 +1,12 @@
my class Bag does Baggy {
has Int $!total;
has Num $!min;
has Num $!max;
has Real $!min;
has Real $!max;
has $!WHICH;

method total (--> Int) { $!total //= [+] self.values }
method min (--> Num) { $!min //= self.values.min }
method max (--> Num) { $!max //= self.values.max }
method min (--> Real) { $!min //= self.values.min }
method max (--> Real) { $!max //= self.values.max }

submethod WHICH { $!WHICH }
submethod BUILD (:%elems) {
Expand Down
4 changes: 2 additions & 2 deletions src/core/Baggy.pm
Expand Up @@ -8,8 +8,8 @@ my role Baggy does QuantHash {
method kv { %!elems.values.map( {.key, .value} ) }
method elems(--> Int) { %!elems.elems }
method total(--> Int) { [+] self.values }
method min(--> Num) { self.values.min }
method max(--> Num) { self.values.max }
method min(--> Real) { self.values.min }
method max(--> Real) { self.values.max }
method exists ($k --> Bool) { # is DEPRECATED doesn't work in settings
DEPRECATED("the :exists adverb");
self.exists_key($k);
Expand Down
4 changes: 2 additions & 2 deletions src/core/Set.pm
Expand Up @@ -5,8 +5,8 @@ my class Set does Setty {
has $!WHICH;

method total (--> Int) { $!total //= %!elems.elems }
method min (--> Num) { $!min //= %!elems.elems ?? 1 !! Inf }
method max (--> Num) { $!max //= %!elems.elems ?? 1 !! -Inf }
method min (--> Real) { $!min //= %!elems.elems ?? 1 !! Inf }
method max (--> Real) { $!max //= %!elems.elems ?? 1 !! -Inf }
submethod WHICH {
$!WHICH := self.^name ~ '|' ~ %!elems.keys.sort if !$!WHICH.defined;
$!WHICH
Expand Down
4 changes: 2 additions & 2 deletions src/core/Setty.pm
Expand Up @@ -8,8 +8,8 @@ my role Setty does QuantHash {
method kv { %!elems.values X, True }
method elems(--> Int) { %!elems.elems }
method total(--> Int) { %!elems.elems }
method min(--> Num) { %!elems.elems ?? 1 !! Inf }
method max(--> Num) { %!elems.elems ?? 1 !! -Inf }
method min(--> Real) { %!elems.elems ?? 1 !! Inf }
method max(--> Real) { %!elems.elems ?? 1 !! -Inf }
method exists ($k --> Bool) { # is DEPRECATED doesn't work in settings
DEPRECATED("the :exists adverb");
self.exists_key($k);
Expand Down

0 comments on commit 2a30681

Please sign in to comment.