# fancydiceops.pm
# a default set of named operations

package fancydice;

our $namedops = {
  'best' => sub
    {
      my ($list) = @_;
      my $count = pop @$list;
      @$list = sort {$b <=> $a} @$list;
      my $len = @$list;
      splice @$list, $count;
      #print 'best:', join (':', @$list), "\n";
    },

  'worst' => sub
    {
      my ($list) = @_;
      my $count = pop @$list;
      @$list = sort {$a <=> $b} @$list;
      my $len = @$list;
      splice @$list, $count;
    }

};

