Permalink
Browse files

infix cmp for Pairs

  • Loading branch information...
1 parent a2b9926 commit 59ec8c6a6b134b094c0c099d5648c3df8e2a4b96 @moritz moritz committed Jul 4, 2011
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/core/Pair.pm
  2. +1 −1 t/spectest.data
View
4 src/core/Pair.pm
@@ -5,3 +5,7 @@ my class Pair is Enum does Associative {
sub infix:«=>»($key, Mu $value) {
Pair.new(:key($key), :value($value))
}
+
+multi infix:<cmp>(Pair \$a, Pair \$b) {
+ ($a.key cmp $b.key) || ($a.value cmp $b.value)
+}
View
2 t/spectest.data
@@ -134,7 +134,7 @@ S03-operators/binding-closure.t
# S03-operators/brainos.t
# S03-operators/buf.t
S03-operators/chained-declarators.t
-# S03-operators/cmp.t
+S03-operators/cmp.t
# S03-operators/comparison.t # need Order::Increase
S03-operators/comparison-simple.t
# S03-operators/context-forcers.t # need True

0 comments on commit 59ec8c6

Please sign in to comment.