branch: externals/heap commit 7f5ab5949f8cee6ac516dea90283b7836c8aed6a Author: Toby Cubitt <toby-predict...@dr-qubit.org> Commit: tsc25 <toby-predict...@dr-qubit.org>
Add heap-root function. --- heap.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/heap.el b/heap.el index 2d96f06..027e45f 100644 --- a/heap.el +++ b/heap.el @@ -306,6 +306,14 @@ to 1.5" +(defun heap-root (heap) + "Return the root of the heap, without removing it" + (if (= (heap--count heap) 0) + nil + (aref (heap--vect heap) 0))) + + + (defun heap-delete-root (heap) "Return the root of the heap and delete it from the heap." (let (vect root (count (heap--count heap)))