Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add .min/.max to Mixes/MixHashes for consistency
  • Loading branch information
lizmat committed Apr 13, 2014
1 parent 4f3553d commit 3ba878f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/Mix.pm
@@ -1,9 +1,11 @@
my class Mix does Mixy {
has Real $!total;
has Real $!min;
has Real $!max;

method total {
$!total //= [+] %!elems.values.map( { .value } );
}
method total (--> Real) { $!total //= [+] self.values }
method min (--> Real) { $!min //= self.values.min }
method max (--> Real) { $!max //= self.values.max }
method at_key($k --> Real) {
my $key := $k.WHICH;
%!elems.exists_key($key)
Expand Down
2 changes: 2 additions & 0 deletions src/core/Mixy.pm
@@ -1,6 +1,8 @@
my role Mixy does Baggy {
method default(--> Real) { 0 }
method total(--> Real) { [+] self.values }
method min(--> Real) { self.values.min }
method max(--> Real) { self.values.max }

method new-fp(*@pairs --> Mixy) {
my %e;
Expand Down

0 comments on commit 3ba878f

Please sign in to comment.