Skip to content

Commit c1b2cb3

Browse files
committed
Add a minmaxheap-cmp infix subroutine
1 parent 508fde7 commit c1b2cb3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use v6;
2+
3+
unit module Algorithm::MinMaxHeap::CmpOperator;
4+
5+
use Algorithm::MinMaxHeap::Comparable;
6+
7+
multi sub infix:<minmaxheap-cmp>(Cool $lhs, Cool $rhs) is export {
8+
return $lhs cmp $rhs;
9+
}
10+
11+
multi sub infix:<minmaxheap-cmp>(Algorithm::MinMaxHeap::Comparable $lhs, Algorithm::MinMaxHeap::Comparable $rhs) returns Order:D is export {
12+
return $lhs.compare-to($rhs);
13+
}
14+

0 commit comments

Comments
 (0)