emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/heap 7f5ab59 10/31: Add heap-root function.


From: Stefan Monnier
Subject: [elpa] externals/heap 7f5ab59 10/31: Add heap-root function.
Date: Mon, 14 Dec 2020 12:13:34 -0500 (EST)

branch: externals/heap
commit 7f5ab5949f8cee6ac516dea90283b7836c8aed6a
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]