diff options
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index f9e0e9c0fa8..5ce4d91ec3e 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el | |||
| @@ -200,18 +200,11 @@ The result is a sequence of the same type as SEQ." | |||
| 200 | TYPE must be one of following symbols: vector, string or list. | 200 | TYPE must be one of following symbols: vector, string or list. |
| 201 | 201 | ||
| 202 | \n(fn TYPE SEQUENCE...)" | 202 | \n(fn TYPE SEQUENCE...)" |
| 203 | ;; Since new seq types might be defined, we need to make sure that | 203 | (pcase type |
| 204 | ;; all seqs are actual sequences. | 204 | (`vector (apply #'vconcat seqs)) |
| 205 | (let ((sequences (seq-map (lambda (s) | 205 | (`string (apply #'concat seqs)) |
| 206 | (if (sequencep s) | 206 | (`list (apply #'append (append seqs '(nil)))) |
| 207 | s | 207 | (_ (error "Not a sequence type name: %S" type)))) |
| 208 | (seq-into s 'list))) | ||
| 209 | seqs))) | ||
| 210 | (pcase type | ||
| 211 | (`vector (apply #'vconcat sequences)) | ||
| 212 | (`string (apply #'concat sequences)) | ||
| 213 | (`list (apply #'append (append sequences '(nil)))) | ||
| 214 | (_ (error "Not a sequence type name: %S" type))))) | ||
| 215 | 208 | ||
| 216 | (cl-defgeneric seq-into (seq type) | 209 | (cl-defgeneric seq-into (seq type) |
| 217 | "Convert the sequence SEQ into a sequence of type TYPE. | 210 | "Convert the sequence SEQ into a sequence of type TYPE. |