branch: externals/dash commit a3cd1ac209c3927e90b263e5748f9f7ad271bbe1 Author: Magnar Sveen <magn...@gmail.com> Commit: Magnar Sveen <magn...@gmail.com>
Alias `-zip-pair`, prepare for breaking change See issue #135 --- README.md | 12 +++++++++++- dash.el | 7 ++++++- readme-template.md | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15af636..f87124f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,13 @@ To get function combinators: ;; Package-Requires: ((dash "2.12.0") (dash-functional "1.2.0") (emacs "24")) +## Upcoming breaking change! + +- For backward compatibility reasons `-zip` return a cons-cell instead of a list + with two elements when called on two lists. This is a clunky API, and in an + upcoming 2.0 release of Dash it will always return a list. If you rely on the + cons-cell return value, use `-zip-pair` instead. + ## Syntax highlighting of dash functions Font lock of dash functions in emacs lisp buffers is now optional. @@ -1434,7 +1441,10 @@ second elements of each list, and so on. The lengths of the returned groupings are equal to the length of the shortest input list. If two lists are provided as arguments, return the groupings as a list -of cons cells. Otherwise, return the groupings as a list of lists. +of cons cells. Otherwise, return the groupings as a list of lists. + +Please note! This distinction is being removed in an upcoming 2.0 +release of Dash. If you rely on this behavior, use -zip-pair instead. ```el (-zip '(1 2 3) '(4 5 6)) ;; => '((1 . 4) (2 . 5) (3 . 6)) diff --git a/dash.el b/dash.el index 7cb844c..88c4c79 100644 --- a/dash.el +++ b/dash.el @@ -1009,7 +1009,10 @@ second elements of each list, and so on. The lengths of the returned groupings are equal to the length of the shortest input list. If two lists are provided as arguments, return the groupings as a list -of cons cells. Otherwise, return the groupings as a list of lists. " +of cons cells. Otherwise, return the groupings as a list of lists. + +Please note! This distinction is being removed in an upcoming 2.0 +release of Dash. If you rely on this behavior, use -zip-pair instead." (let (results) (while (-none? 'null lists) (setq results (cons (mapcar 'car lists) results)) @@ -1021,6 +1024,8 @@ of cons cells. Otherwise, return the groupings as a list of lists. " (--map (cons (car it) (cadr it)) results) results))) +(defalias '-zip-pair '-zip) + (defun -zip-fill (fill-value &rest lists) "Zip LISTS, with FILL-VALUE padded onto the shorter lists. The lengths of the returned groupings are equal to the length of the diff --git a/readme-template.md b/readme-template.md index 6d3dbd2..95a7b37 100644 --- a/readme-template.md +++ b/readme-template.md @@ -25,6 +25,13 @@ To get function combinators: ;; Package-Requires: ((dash "2.12.0") (dash-functional "1.2.0") (emacs "24")) +## Upcoming breaking change! + +- For backward compatibility reasons `-zip` return a cons-cell instead of a list + with two elements when called on two lists. This is a clunky API, and in an + upcoming 2.0 release of Dash it will always return a list. If you rely on the + cons-cell return value, use `-zip-pair` instead. + ## Syntax highlighting of dash functions Font lock of dash functions in emacs lisp buffers is now optional.