[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/heap 75b42f4 04/31: Version 0.9.1 of the predictive com
From: |
Stefan Monnier |
Subject: |
[elpa] externals/heap 75b42f4 04/31: Version 0.9.1 of the predictive completion package. |
Date: |
Mon, 14 Dec 2020 12:13:32 -0500 (EST) |
branch: externals/heap
commit 75b42f4594a9383bcdf7d462666da18f79bdaa2b
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <tsc25@cantab.net>
Version 0.9.1 of the predictive completion package.
---
heap.el | 66 ++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 33 insertions(+), 33 deletions(-)
diff --git a/heap.el b/heap.el
index f7e5658..d4b817a 100644
--- a/heap.el
+++ b/heap.el
@@ -4,7 +4,7 @@
;; Copyright (C) 2004 2005 Toby Cubitt
;; Author: Toby Cubitt
-;; Version: 0.1.1
+;; Version: 0.1.2
;; Keywords: heap, priority queue
;; This file is part of the Emacs Predictive Completion package.
@@ -44,6 +44,9 @@
;;; Change log:
;;
+;; Version 0.1.2
+;; * moved defmacros before their first use so byte-compilation works
+;;
;; Version 0.1.1
;; * added cl dependency
;;
@@ -62,6 +65,7 @@
+
;;; ================================================================
;;; Internal functions for use in the heap package
@@ -87,6 +91,34 @@
+(defmacro hp-child (heap i)
+ ;; Compare the 3 children of element I, and return element reference of the
+ ;; smallest/largest (depending on whethen it's a min- or max-heap).
+ ;; INTERNAL USE ONLY
+ `(let* ((vect (hp-vect ,heap))
+ (cmpfun (hp-cmpfun ,heap))
+ (len (length vect)) (j nil) (k (* 3 ,i)))
+ ;; Lots of if's in case I has less than three children.
+ (if (>= (1+ k) len) nil
+ (if (>= (+ 2 k) len) (1+ k)
+ (setq j (if (funcall cmpfun (aref vect (1+ k)) (aref vect (+ 2 k)))
+ (1+ k) (+ 2 k)))
+ (if (>= (+ 3 k) len) j
+ (if (funcall cmpfun (aref vect j) (aref vect (+ 3 k))) j (+ 3 k)))
+ )))
+)
+
+
+
+(defmacro vswap (vect i j)
+ ;; Swap elements I and J of vector VECT.
+ `(let ((tmp (aref ,vect ,i)))
+ (aset ,vect ,i (aref ,vect ,j))
+ (aset ,vect ,j tmp) ,vect)
+)
+
+
+
(defun hp-sift-up (heap n)
;; Sift-up starting from element N of the heap vector belonging to
;; heap HEAP. ;; INTERNAL USE ONLY
@@ -120,38 +152,6 @@
-(defmacro hp-child (heap i)
- ;; Compare the 3 children of element I, and return element reference of the
- ;; smallest/largest (depending on whethen it's a min- or max-heap).
- ;; INTERNAL USE ONLY
- `(let* ((vect (hp-vect ,heap))
- (cmpfun (hp-cmpfun ,heap))
- (len (length vect)) (j nil) (k (* 3 ,i)))
- ;; Lots of if's in case I has less than three children.
- (if (>= (1+ k) len) nil
- (if (>= (+ 2 k) len) (1+ k)
- (setq j (if (funcall cmpfun (aref vect (1+ k)) (aref vect (+ 2 k)))
- (1+ k) (+ 2 k)))
- (if (>= (+ 3 k) len) j
- (if (funcall cmpfun (aref vect j) (aref vect (+ 3 k))) j (+ 3 k)))
- )))
-)
-
-
-
-
-
-;;; ================================================================
-;;; Utility functions used in the heap package
-
-(defmacro vswap (vect i j)
- ;; Swap elements I and J of vector VECT.
- `(let ((tmp (aref ,vect ,i)))
- (aset ,vect ,i (aref ,vect ,j))
- (aset ,vect ,j tmp) ,vect)
-)
-
-
;;; ================================================================
- [elpa] externals/heap 37bc0e9 05/31: Version 0.10 of the predictive completion package., (continued)
- [elpa] externals/heap 37bc0e9 05/31: Version 0.10 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 03a876d 02/31: Version 0.2 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap ceb5dd1 21/31: Trivial whitespace tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 17429ee 07/31: Version 0.12 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 55d47fd 11/31: Fixed ancient but overlooked bug in heap resizing in heap-add., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 9bcd8d3 16/31: Added heap-build function for efficiently building a heap out of a vector., Stefan Monnier, 2020/12/14
- [elpa] externals/heap ed90e4d 09/31: Adding missing 'buffer setting to customization menu for predictive-auto-add-to-dict., Stefan Monnier, 2020/12/14
- [elpa] externals/heap f74c766 15/31: Converted heap data structures to defstructs., Stefan Monnier, 2020/12/14
- [elpa] externals/heap e354b4f 19/31: Revert default heap size to 10., Stefan Monnier, 2020/12/14
- [elpa] externals/heap e2c16be 06/31: Version 0.10.3 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 75b42f4 04/31: Version 0.9.1 of the predictive completion package.,
Stefan Monnier <=
- [elpa] externals/heap 2d51c84 01/31: Version 0.1 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 227de61 03/31: Version 0.7 of the predictive completion package., Stefan Monnier, 2020/12/14
- [elpa] externals/heap da9637e 25/31: Added heap-clear function., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 4407826 22/31: More minor whitespace and commentary changes., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 7f5ab59 10/31: Add heap-root function., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 304c604 13/31: Fixed bug in heap-copy., Stefan Monnier, 2020/12/14
- [elpa] externals/heap fcf3edd 18/31: Added autoload cookies., Stefan Monnier, 2020/12/14
- [elpa] externals/heap a3ddd78 23/31: Remove ChangeLogs from library headers., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 5ad96c3 14/31: Updated Package-Version, Package-Requires, and Keywords package headers., Stefan Monnier, 2020/12/14
- [elpa] externals/heap 11738aa 12/31: Re-filled to 72 chars/line, for mailing to gnu-emacs-sources list, Stefan Monnier, 2020/12/14