Merge pull request #262 from basil-conto/blc/common-prefix

Safer -common-prefix via breadth-first traversal
master
Matus Goljer 8 years ago committed by GitHub
commit c1991d4c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      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)

Loading…
Cancel
Save