1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Add seq-mapcat

* lisp/emacs-lisp/seq.el (seq-mapcat): New function
* test/automated/seq-tests.el: Add unit tests for seq-mapcat
This commit is contained in:
Nicolas Petton 2015-02-06 15:52:23 +01:00
parent 5c9ad35f1e
commit 05211a578e
4 changed files with 25 additions and 3 deletions

View file

@ -2,9 +2,9 @@
;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
;; Author: Nicolas Petton <petton.nicolas@gmail.com>
;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: sequences
;; Version: 1.0
;; Version: 1.1
;; Maintainer: emacs-devel@gnu.org
@ -224,6 +224,12 @@ TYPE must be one of following symbols: vector, string or list.
(`list (apply #'append (append seqs '(nil))))
(t (error "Not a sequence type name: %s" type))))
(defun seq-mapcat (function seq &optional type)
"Concatenate the result of applying FUNCTION to each element of SEQ.
The result is a sequence of type TYPE, or a list if TYPE is nil."
(apply #'seq-concatenate (or type 'list)
(seq-map function seq)))
(defun seq--drop-list (list n)
"Optimized version of `seq-drop' for lists."
(while (and list (> n 0))