<
to...@tuxteam.de> writes:
> On Wed, May 18, 2016 at 07:12:56AM +0200, Marcin Borkowski wrote:
>> Hi,
>>
>> I have a list of lists of atoms, and I want to have a flat list
>> containing these atoms. I could use -flatten from dash.el, but I'd
>> prefer not to introduce such a dependency for this one function alone.
>> Is there anything *in core Emacs* to do it, or should I just write my
>> own version?
>
> (setq l '((a b c) (d e f) (g h i)))
> (apply 'append l)
> => (a b c d e f g h i)
>
> No idea whether performance or edge cases match your requirements,
> though :)
append will refer to the last list in that literal list, thus making the
result half literal. This may be a problem or not, depending on how you
use this result.
You can use concatenate (cl-concatenate) instead, if you want to copy
even the last subsequence:
(apply 'concatenate 'list l)
--> (a b c d e f g h i)
--
__Pascal Bourguignon__
http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk