[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: append, push, and add-to-list.
From: |
Jean Louis |
Subject: |
Re: append, push, and add-to-list. |
Date: |
Sun, 4 Jul 2021 07:35:44 +0300 |
User-agent: |
Mutt/2.0.7+183 (3d24855) (2021-05-28) |
* Hongyi Zhao <hongyi.zhao@gmail.com> [2021-07-04 06:19]:
> I've noticed there are some similar functions, i.e., append, push, and
> add-to-list, for revising/updating the content of a list. But I'm
> still not so clear on the specific use scenarios for them. Consider
> the following command [1]:
>
> (push '(company-capf company-ispell) company-backends)
>
> What's the equivalent representations using append and add-to-list?
> Which methods are preferable?
It is recommended to review documentation for each function by using
{C-h f} -
- function add-to-list is traditionally rather used in configurations,
how I see it, like (add-to-list 'load-path "/my/directory") or
similar, instead, in programming code one shall rather use `push' or
`cl-pushnew' as `add-to-list' adds only new unique elements;
Because you use it more for configurations, then add-to-list would be:
(add-to-list 'company-backends '(company-capf company-ispell))
and with append
(append company-backends '(company-capf company-ispell))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- append, push, and add-to-list., Hongyi Zhao, 2021/07/03
- Re: append, push, and add-to-list.,
Jean Louis <=
- Re: append, push, and add-to-list., Hongyi Zhao, 2021/07/04
- Re: append, push, and add-to-list., Jean Louis, 2021/07/04
- Re: append, push, and add-to-list., Hongyi Zhao, 2021/07/04
- Re: append, push, and add-to-list., Jean Louis, 2021/07/04
- Re: append, push, and add-to-list., Hongyi Zhao, 2021/07/04
- RE: [External] : Re: append, push, and add-to-list., Drew Adams, 2021/07/04
- Re: append, push, and add-to-list., Emanuel Berg, 2021/07/04
Re: append, push, and add-to-list., Emanuel Berg, 2021/07/04