Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

generialize cmp candidate from Pair to Enum

  • Loading branch information...
commit a3407dee0585c9788e54f778904f538f6ffca989 1 parent 90333b3
@moritz moritz authored
Showing with 3 additions and 4 deletions.
  1. +3 −0  src/core/Enum.pm
  2. +0 −4 src/core/Pair.pm
View
3  src/core/Enum.pm
@@ -42,3 +42,6 @@ multi sub infix:<eqv>(Enum:D $a, Enum:D $b) {
$a.WHAT === $b.WHAT && $a.key eqv $b.key && $a.value eqv $b.value
}
+multi infix:<cmp>(Enum:D \$a, Enum:D \$b) {
+ ($a.key cmp $b.key) || ($a.value cmp $b.value)
+}
View
4 src/core/Pair.pm
@@ -13,7 +13,3 @@ my class Pair is Enum {
sub infix:«=>»($key, Mu $value) {
Pair.new(:key($key), :value($value))
}
-
-multi infix:<cmp>(Pair:D \$a, Pair:D \$b) {
- ($a.key cmp $b.key) || ($a.value cmp $b.value)
-}
Please sign in to comment.
Something went wrong with that request. Please try again.