[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs]
From: |
Stefan Monnier |
Subject: |
Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs] |
Date: |
Sun, 10 May 2020 15:31:43 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> there I think I just want flatten to exist already.
His point was: it's rare to need exactly `flatten` (which BTW is called
`flatten-tree` since Emacs-27 ;-).
AFAIK in most cases what you really want is something along the lines of
(apply #'append X), i.e. a "one-level flatten".
As its name implies, `flatten-tree` really operates on a tree, but it's
very rare to represent trees in Elisp in such a way that all non-cons
cells are elements of the tree, so `flatten-tree` rarely does something
meaningful on a tree.
But yes, there are several cases where you may happen to know that
`flatten-tree` will work because it won't have the opportunity to go
deeper than the first level. I.e. you have a "list of lists of strings"
or a "list of either strings or lists of strings", so you won't see the
difference between `flatten-tree` and a hypothetical one-level flatten.
Stefan
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], (continued)
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Philippe Vaucher, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], 조성빈, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Joost Kremers, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Philippe Vaucher, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Richard Stallman, 2020/05/09
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Philippe Vaucher, 2020/05/10
- RE: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Drew Adams, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Philippe Vaucher, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Alfred M. Szmidt, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Phillip Lord, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs],
Stefan Monnier <=
- RE: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Drew Adams, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Richard Stallman, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Richard Stallman, 2020/05/10
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Phillip Lord, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Richard Stallman, 2020/05/11
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Joost Kremers, 2020/05/12
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Stefan Monnier, 2020/05/12
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Phillip Lord, 2020/05/12
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Stefan Monnier, 2020/05/12
- Re: dash.el [was: Re: Imports / inclusion of s.el into Emacs], Phillip Lord, 2020/05/12