- heap->alist heapprocedure
Convert the heap into a key-sorted list of key-value pairs by iteratively extracting the extremum; see also heap->list.
- The heap to convert
(define (heap->alist heap) (let ((heap (heap-copy heap))) (do ((list '() (let ((datum (heap-extremum heap))) (alist-cons (heap-key heap datum) (heap-extract-extremum! heap) list)))) ((heap-empty? heap) list))))