+2015-02-06 Nicolas Petton <nicolas@petton.fr>
+
+ * emacs-lisp/seq.el (seq-mapcat): New function.
+
2015-02-06 Artur Malabarba <bruce.connor.am@gmail.com>
* doc-view.el (doc-view-kill-proc-and-buffer): Obsolete. Use
;; 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
(`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))
+2015-02-02 Nicolas Petton <nicolas@petton.fr>
+
+ * automated/seq-tests.el: New test for seq-mapcat.
+
2015-02-05 Artur Malabarba <bruce.connor.am@gmail.com>
* automated/package-test.el (package-test-get-deps): Fix typo.
;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
-;; Author: Nicolas Petton <petton.nicolas@gmail.com>
+;; Author: Nicolas Petton <nicolas@petton.fr>
;; Maintainer: emacs-devel@gnu.org
;; This file is part of GNU Emacs.
(should (equal (seq-concatenate 'vector nil '(8 10)) [8 10]))
(should (equal (seq-concatenate 'vector seq nil) [2 4 6]))))
+(ert-deftest test-seq-mapcat ()
+ (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)))
+ '(1 2 3 4 5 6)))
+ (should (equal (seq-mapcat #'seq-reverse '[(3 2 1) (6 5 4)])
+ '(1 2 3 4 5 6)))
+ (should (equal (seq-mapcat #'seq-reverse '((3 2 1) (6 5 4)) 'vector)
+ '[1 2 3 4 5 6])))
+
(provide 'seq-tests)
;;; seq-tests.el ends here