help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to flatten a one-level-deep list?


From: Michael Heerdegen
Subject: Re: How to flatten a one-level-deep list?
Date: Fri, 20 May 2016 17:01:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.94 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > C-h a flatten RET anyone?
>
> `flatten' is not a (one-level-deep) list operation, but a tree
> operation.

How would you call the proposed functionality then?

I'm asking because I incidentally need a name for the analog stream
operation I want to add to stream.el:

#+begin_src emacs-lisp
(defun stream-??? (stream-of-streams)
  "Concatenate all streams in STREAM-OF-STREAMS an return the result.
All elements in STREAM-OF-STREAMS must be streams.  The result is
always a stream."
  (stream-reduce #'stream-append (stream-empty) stream-of-streams))
#+end_src

(`stream-reduce' will be part of the patch; `stream-append' is already
existing in stream.el and has signature (&rest streams).)


Thanks,

Michael.




reply via email to

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