Skip to content

Instantly share code, notes, and snippets.

@VienosNotes
Created August 24, 2011 17:45
Show Gist options
  • Save VienosNotes/1168651 to your computer and use it in GitHub Desktop.
Save VienosNotes/1168651 to your computer and use it in GitHub Desktop.
mD6 + nD10 in Perl6 (2)
use v6;
multi sub infix:<D> ($lhs, $rhs) {
my $sum = 0;
$sum += $rhs.rand.Int for 1..$lhs;
return $sum;
}
multi sub infix:<D> ($lhs, $rhs where {$_ == 6} ) {
return &infix:<D>.candidates[0]($lhs, $rhs) + $lhs;
}
my ($m, $n) = @*ARGS;
say ($m D 6) + ($n D 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment