branch: externals/dash
commit beea1a3e3d3a23311c6a3d410319e5e487f35d61
Author: Basil L. Contovounesios <conto...@tcd.ie>
Commit: Basil L. Contovounesios <conto...@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