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

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

Re: append, push, and add-to-list.


From: Hongyi Zhao
Subject: Re: append, push, and add-to-list.
Date: Sun, 4 Jul 2021 21:50:39 +0800

On Sun, Jul 4, 2021 at 7:32 PM Jean Louis <bugs@gnu.support> wrote:
>
> * Hongyi Zhao <hongyi.zhao@gmail.com> [2021-07-04 08:12]:
> > Thank you. I listed the usages below for all above-mentioned functions
> > by {C-h f} function-name:
> >
> > (add-to-list LIST-VAR ELEMENT &optional APPEND COMPARE-FN)
> > (push NEWELT PLACE)
> > (cl-pushnew X PLACE [KEYWORD VALUE]...)
> > (append &rest SEQUENCES)
>
> Good, I can also see some possible inconsistencies with X and NEWELT,
> as it would be better to call X also NEWELT. I can also see that
> documentation for `cl-pushnew' is not adequate enough. You are
> probably expected to learn definition from Common Lisp to understand
> the KEYWORDs:
> http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/mac_pushnew.html#pushnew
>
> Function `append' will work with various sequences not just lists.
>
> Please see manual: (info "(elisp) Sequences Arrays Vectors")
>
> > > Because you use it more for configurations, then add-to-list would be:
> > >
> > > (add-to-list 'company-backends '(company-capf company-ispell))
> >
> > Why can't this be written as follows, just like the other two?
> >
> > (add-to-list company-backends '(company-capf company-ispell))
> >
> > >
> > > and with append
> > >
> > > (append company-backends '(company-capf company-ispell))
>
> Functions `add-to-list' and `append' do different things, though
> similar.
>

I'm curious why `add-to-list' must take 'company-backends, i.e.,
(quote company-backends) as one of its argument, while the other
functions can directly use the unquoted form.

HY
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
NO. 552 North Gangtie Road, Xingtai, China



reply via email to

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