1. my role Mixy does Baggy {
  2. method !PAIR(\key,\value) { Pair.new(key, my Real $ = value ) }
  3. method !SANITY(%elems --> Nil) {
  4. for %elems -> $p {
  5. %elems.DELETE-KEY($p.key) if $p.value.value == 0;
  6. }
  7. }
  8. multi method kxxv(Mixy:D:) {
  9. Failure.new(".kxxv is not supported on a {self.^name}")
  10. }
  11. multi method grab(Mixy:D: $count?) {
  12. Failure.new(".grab is not supported on a {self.^name}")
  13. }
  14. multi method pick(Mixy:D: $count?) {
  15. Failure.new(".pick is not supported on a {self.^name}")
  16. }
  17. multi method roll(Mixy:D:) {
  18. Rakudo::Internals::WeightedRoll.new(self).roll
  19. }
  20. multi method roll(Mixy:D: $count) {
  21. my $roller = Rakudo::Internals::WeightedRoll.new(self);
  22. map { $roller.roll }, 1 .. $count;
  23. }
  24. }