Skip to content

Commit

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

method total (--> Int) { $!total //= [+] self.values }
method min (--> Int) { $!min //= self.values.min }
method max (--> Int) { $!max //= self.values.max }
method min (--> Num) { $!min //= self.values.min }
method max (--> Num) { $!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(--> Int) { self.values.min }
method max(--> Int) { self.values.max }
method min(--> Num) { self.values.min }
method max(--> Num) { self.values.max }
method exists ($k --> Bool) { # is DEPRECATED doesn't work in settings
DEPRECATED("the :exists adverb");
self.exists_key($k);
Expand Down
8 changes: 4 additions & 4 deletions src/core/Set.pm
@@ -1,12 +1,12 @@
my class Set does Setty {
has Int $!total;
has Int $!min;
has Int $!max;
has Num $!min;
has Num $!max;
has $!WHICH;

method total (--> Int) { $!total //= %!elems.elems }
method min (--> Int) { $!min //= %!elems.elems ?? 1 !! Inf }
method max (--> Int) { $!max //= %!elems.elems ?? 1 !! -Inf }
method min (--> Num) { $!min //= %!elems.elems ?? 1 !! Inf }
method max (--> Num) { $!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(--> Int) { %!elems.elems ?? 1 !! Inf }
method max(--> Int) { %!elems.elems ?? 1 !! -Inf }
method min(--> Num) { %!elems.elems ?? 1 !! Inf }
method max(--> Num) { %!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 dca5394

Please sign in to comment.