From 42bd621cce31af36723e17bc58cc45a96bbc933d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 29 Aug 2008 02:13:27 -0500 Subject: [PATCH] ERROR: instead of throw --- basis/heaps/heaps.factor | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/basis/heaps/heaps.factor b/basis/heaps/heaps.factor index 1873db67b5..bb110bbf20 100755 --- a/basis/heaps/heaps.factor +++ b/basis/heaps/heaps.factor @@ -2,7 +2,7 @@ ! Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences arrays assocs sequences.private -growable accessors math.order ; +growable accessors math.order summary ; IN: heaps GENERIC: heap-push* ( value key heap -- entry ) @@ -161,10 +161,13 @@ M: heap heap-push* ( value key heap -- entry ) M: heap heap-peek ( heap -- value key ) data-first >entry< ; +ERROR: bad-heap-delete ; + +M: bad-heap-delete summary + drop "Invalid entry passed to heap-delete" ; + : entry>index ( entry heap -- n ) - over entry-heap eq? [ - "Invalid entry passed to heap-delete" throw - ] unless + over entry-heap eq? [ bad-heap-delete ] unless entry-index ; M: heap heap-delete ( entry heap -- )