summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/heap.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/chickadee/heap.scm b/chickadee/heap.scm
index db9bea9..3a7d17e 100644
--- a/chickadee/heap.scm
+++ b/chickadee/heap.scm
@@ -96,7 +96,8 @@
(let ((size (1- (heap-size heap)))
(< (heap-< heap)))
(define (finish hole)
- (heap-set! heap hole (heap-ref heap (heap-size heap)))
+ (heap-set! heap (heap-size heap) #f)
+ (heap-set! heap 0 #f)
(set-heap-size! heap size)
*unspecified*)
@@ -120,7 +121,9 @@
(if (< (heap-ref heap hole) (heap-ref heap child))
(finish hole)
(begin
+ (heap-set! heap 0 (heap-ref heap hole))
(heap-set! heap hole (heap-ref heap child))
+ (heap-set! heap child (heap-ref heap 0))
(loop child))))))))
(define (heap-clear! heap)