From 6ab848775efda69a4e98d769da21dadf32647701 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 9 Jul 2014 18:12:10 -0700 Subject: [PATCH] heaps: use before? and after?. --- basis/heaps/heaps.factor | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/basis/heaps/heaps.factor b/basis/heaps/heaps.factor index 170e33595d..dccf1e5e55 100644 --- a/basis/heaps/heaps.factor +++ b/basis/heaps/heaps.factor @@ -83,12 +83,11 @@ M: heap heap-size ( heap -- n ) GENERIC: heap-compare ( entry1 entry2 heap -- ? ) -: entry<=> ( entry1 entry2 -- <=> ) - { entry entry } declare [ key>> ] compare ; inline +M: min-heap heap-compare + drop { entry entry } declare [ key>> ] bi@ after? ; inline -M: min-heap heap-compare drop entry<=> +gt+ eq? ; - -M: max-heap heap-compare drop entry<=> +lt+ eq? ; +M: max-heap heap-compare + drop { entry entry } declare [ key>> ] bi@ before? ; inline : heap-bounds-check? ( m heap -- ? ) heap-size >= ; inline