[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to specialize seq-concatenate and seq-into-sequence?

From: Michael Heerdegen
Subject: Re: How to specialize seq-concatenate and seq-into-sequence?
Date: Fri, 04 Mar 2022 23:12:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier via Users list for the GNU Emacs text editor
<> writes:

> > How would you concatenate a list and a stream to a list?
> I don't understand the question.

I wanted to imply that (seq-into 'list (list 1 2) (stream (list 3 4)))

> > Or how would you implement it?
> `seq-do` iteration on the various sequences seems like an
> obvious solution.
> > Would wrapping `seq-into' over the SEQUENCES be better than only relying
> > on dispatching?
> I don't understand this question either.

Why `seq-do'?  My idea was to do this:

>From 9937c190af8a9cb95c52039ef98e26ac9a2e9fe0 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <>
Date: Fri, 4 Mar 2022 23:09:28 +0100
Subject: [PATCH] WIP: seq-concatenate: transform SEQUENCE arguments

 lisp/emacs-lisp/seq.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index cb1b822f85..331e5755d8 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -299,6 +299,7 @@ seq-concatenate
 TYPE must be one of following symbols: vector, string or list.
 \n(fn TYPE SEQUENCE...)"
+  (setq sequences (mapcar (lambda (s) (seq-into s type)) sequences))
   (pcase type
     ('vector (apply #'vconcat sequences))
     ('string (apply #'concat sequences))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]