[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: |
Mon, 5 Jul 2021 13:07:56 +0800 |
On Mon, Jul 5, 2021 at 12:32 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> >> Does the following append `el' to `lst'?
> >>
> >> (setq lst `(,@lst el))
> >
> > Yes, literally, but maybe it makes more sense if that is
> > evaluated as well?
> >
> > (defvar lst)
> > (setq lst '(a b c))
> >
> > (defvar el)
> > (setq el 4)
> >
> > (setq lst `(,@lst ,el))
> >
> > Now "lst" will be (a b c 4)
>
> (setq lst '(a b))
> (setq lst `(,@lst logic) ; (a b logic)
>
You have a typo here, should be the following:
((setq lst `(,@lst logic))
Wonderful examples, but how to eval multiple line lisp codes in
scratch buffer? I only know with twice hitting of `C-j' for this job,
as shown below:
(setq lst '(a b)) <--- C-j
(a b)
((setq lst `(,@lst logic)) <-- C-j
(a b logic)
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
- Re: append, push, and add-to-list., (continued)
- 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
- Re: append, push, and add-to-list., Hongyi Zhao, 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/05
- Re: append, push, and add-to-list.,
Hongyi Zhao <=
- Re: append, push, and add-to-list., Emanuel Berg, 2021/07/05
- Re: append, push, and add-to-list., Hongyi Zhao, 2021/07/05
Re: append, push, and add-to-list., Jean Louis, 2021/07/05
Re: append, push, and add-to-list., Hongyi Zhao, 2021/07/05
Re: append, push, and add-to-list., Emanuel Berg, 2021/07/05
Re: append, push, and add-to-list., Drew Adams, 2021/07/05
- Re: append, push, and add-to-list., Emanuel Berg, 2021/07/05
- Re: append, push, and add-to-list., Stefan Monnier, 2021/07/05
- RE: [External] : Re: append, push, and add-to-list., Drew Adams, 2021/07/05
- Re: append, push, and add-to-list., Emanuel Berg, 2021/07/05