diff options
author | Nicolas Petton <nicolas@petton.fr> | 2015-03-09 12:46:29 +0100 |
---|---|---|
committer | Nicolas Petton <nicolas@petton.fr> | 2015-03-09 12:50:24 +0100 |
commit | b7ed48c3ce8e77acc08d4948684333bef3238d2d (patch) | |
tree | f391b49af05d99cdde85b933bdaeb1e6598d146c /lisp/emacs-lisp | |
parent | 8854b9cf5283cac3e4a5a3726325a82b88c1fcb5 (diff) | |
download | emacs-b7ed48c3ce8e77acc08d4948684333bef3238d2d.tar.gz emacs-b7ed48c3ce8e77acc08d4948684333bef3238d2d.tar.bz2 emacs-b7ed48c3ce8e77acc08d4948684333bef3238d2d.zip |
Add seq-into as a public function
* lisp/emacs-lisp/seq.el: Make seq-into a public function (replacing
seq--into)
* test/automated/seq-tests.el: Add tests for seq-into
* doc/lispref/sequences.texi: Add documentation for seq-into
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/seq.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index ad4c3536b44..59b91408d09 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -4,7 +4,8 @@ ;; Author: Nicolas Petton <nicolas@petton.fr> ;; Keywords: sequences -;; Version: 1.2 +;; Version: 1.3 +;; Package: seq ;; Maintainer: emacs-devel@gnu.org @@ -171,7 +172,7 @@ The result is a sequence of the same type as SEQ." (if (listp seq) (sort (seq-copy seq) pred) (let ((result (seq-sort pred (append seq nil)))) - (seq--into result (type-of seq))))) + (seq-into result (type-of seq))))) (defun seq-contains-p (seq elt &optional testfn) "Return the first element in SEQ that equals to ELT. @@ -265,10 +266,11 @@ See also the function `nreverse', which is used more often." seq) (if (listp seq) result - (seq--into result (type-of seq))))))) + (seq-into result (type-of seq))))))) -(defun seq--into (seq type) - "Convert the sequence SEQ into a sequence of type TYPE." +(defun seq-into (seq type) + "Convert the sequence SEQ into a sequence of type TYPE. +TYPE can be one of the following symbols: vector, string or list." (pcase type (`vector (vconcat seq)) (`string (concat seq)) |