Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created May 1, 2017 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/93493f687dbfdb7864813b120d2e5c77 to your computer and use it in GitHub Desktop.
Save zoffixznet/93493f687dbfdb7864813b120d2e5c77 to your computer and use it in GitHub Desktop.
+multi sub infix:<cmp>(NumericStr:D $a, NumericStr:D $b) is default {
+ $a.Numeric cmp $b.Numeric || $a.Str cmp $b.Str
+}
+multi sub infix:<eqv>(NumericStr:D $a, NumericStr:D $b) is default {
+ $a.Numeric eqv $b.Numeric || $a.Str eqv $b.Str
+}
proto sub infix:<but>(|) is pure { * }
multi sub infix:<but>(Mu:D \obj, Mu:U \rolish) {
cpan@perlbuild3~/CPANPRC/rakudo (nom)$ ./perl6 -e 'dd <1.0> cmp <1.0>'
Ambiguous call to 'infix:<cmp>'; these signatures all match:
:(Str:D \a, Str:D \b --> Order:D)
:(Rational:D \a, Rational:D \b)
:(NumericStr:D $a, NumericStr:D $b)
in block <unit> at -e line 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment