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

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

[elpa] externals/trie da9ace9 051/111: More efficient implementations of


From: Stefan Monnier
Subject: [elpa] externals/trie da9ace9 051/111: More efficient implementations of replacements for CL 'position' function.
Date: Mon, 14 Dec 2020 11:35:18 -0500 (EST)

branch: externals/trie
commit da9ace91c0432bbc1b7c9878277e06d5c008e4b6
Author: tsc25 <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    More efficient implementations of replacements for CL 'position' function.
---
 trie.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/trie.el b/trie.el
index ec35efe..d2c5929 100644
--- a/trie.el
+++ b/trie.el
@@ -472,12 +472,13 @@ If START or END is negative, it counts from the end."
   "Find the first occurrence of ITEM in LIST.
 Return the index of the matching item, or nil of not found.
 Comparison is done with 'equal."
-  (let (el (i 0))
+  (let ((i 0))
     (catch 'found
-      (while (setq el (nth i list))
-        (when (equal item el) (throw 'found i))
-        (setq i (1+ i))
-        nil))))
+      (while (progn
+              (when (equal item (car list)) (throw 'found i))
+              (setq i (1+ i))
+              (setq list (cdr list))))
+      nil)))
 
 
 (defsubst trie--seq-append (seq el)



reply via email to

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