Skip to content

Commit

Permalink
generialize cmp candidate from Pair to Enum
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Jun 13, 2012
1 parent 90333b3 commit a3407de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/core/Enum.pm
Expand Up @@ -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)
}
4 changes: 0 additions & 4 deletions src/core/Pair.pm
Expand Up @@ -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)
}

0 comments on commit a3407de

Please sign in to comment.