 
 ERROR: bad-heap-delete ;
 
-M: bad-heap-delete summary 
+M: bad-heap-delete summary
     drop "Invalid entry passed to heap-delete" ;
 
 : entry>index ( entry heap -- n )
     over heap>> eq? [ bad-heap-delete ] unless
-    index>> ;
+    index>> { fixnum } declare ; inline
 
 M: heap heap-delete ( entry heap -- )
     [ entry>index ] [ ] bi

    [ dup heap-pop swap 2array ]
    produce nip ;

: slurp-heap ( heap quot: ( elt -- ) -- )
    over heap-empty? [ 2drop ] [
        [ [ heap-pop drop ] dip call ] [ slurp-heap ] 2bi
    ] if ; inline recursive

! Copyright (C) 2007, 2008 Ryan Murphy, Doug Coleman,
! Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs combinators fry growable kernel
kernel.private math math.order math.private sequences
sequences.private summary vectors ;

IN: heaps

GENERIC: heap-push* ( value key heap -- entry )
