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

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

[elpa] externals/dash beea1a3 098/316: Simplify --common-prefix implemen


From: ELPA Syncer
Subject: [elpa] externals/dash beea1a3 098/316: Simplify --common-prefix implementation
Date: Mon, 15 Feb 2021 15:57:34 -0500 (EST)

branch: externals/dash
commit beea1a3e3d3a23311c6a3d410319e5e487f35d61
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Simplify --common-prefix implementation
---
 dash.el | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/dash.el b/dash.el
index e8ff669..bb16d9e 100644
--- a/dash.el
+++ b/dash.el
@@ -2118,10 +2118,7 @@ or with `-compare-fn' if that's non-nil."
 (defun -common-prefix (&rest lists)
   "Return the longest common prefix of LISTS."
   (declare (pure t) (side-effect-free t))
-  (--reduce (let (head prefix)
-              (while (and acc it (equal (setq head (pop acc)) (pop it)))
-                (push head prefix))
-              (nreverse prefix))
+  (--reduce (--take-while (and acc (equal (pop acc) it)) it)
             lists))
 
 (defun -contains? (list element)



reply via email to

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