branch: externals/dash commit c1991d4c22f356be21df6b3badd7233a94df7937 Merge: 138c22a beea1a3 Author: Matus Goljer <dota.k...@gmail.com> Commit: GitHub <nore...@github.com>
Merge pull request #262 from basil-conto/blc/common-prefix Safer -common-prefix via breadth-first traversal --- 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)