From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: append, push, and add-to-list. Date: Mon, 5 Jul 2021 13:07:56 +0800 Message-ID: References: <8735suaw71.fsf@zoho.eu> <87czrxifp4.fsf@zoho.eu> <878s2lidp1.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33294"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 05 07:08:52 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0Gqi-0008Z8-38 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 05 Jul 2021 07:08:52 +0200 Original-Received: from localhost ([::1]:50810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0Gqg-0006vy-TB for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 05 Jul 2021 01:08:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44222) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0Gq3-0006vn-AO for help-gnu-emacs@gnu.org; Mon, 05 Jul 2021 01:08:11 -0400 Original-Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:38549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0Gq1-0002uN-VB for help-gnu-emacs@gnu.org; Mon, 05 Jul 2021 01:08:11 -0400 Original-Received: by mail-lj1-x22a.google.com with SMTP id t30so2932465ljo.5 for ; Sun, 04 Jul 2021 22:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=vC3evCBBnxWBw7w6qSB3TQqqn2P6XVNSkQ0LMvHpE5o=; b=mqVAkQLUMnmThyTPacy6RIphNYeSy19hXc4VHV+e/1s7GtxlHJRos6akdpxpCiOCel RIDkPkqAExKoJzk1STSNGp8zqQmd1BETM9aW5dHhO9Bai5t6SAgyeAaub9lr9EfEhQEA qmDUsO4pP/YizIP3TPGswcHFCwTiwv43WCUvsLsUPN0jHyszh7BnHAZLrd8lY0gk0vE3 EY8McqXK20b0KTrcNwMkMC2kQFenJLEXGs0o9JvlnejeDgmQSyvQwgCgayxq6VYqYYiR fW2kie/03uwMmtdxXx1friE2KuQ9APaEuU8HAIDvyR7kyaWGOdC2EIwI+GNSDZ0oyHtB srMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=vC3evCBBnxWBw7w6qSB3TQqqn2P6XVNSkQ0LMvHpE5o=; b=MzXIjHDHOEqcC2eSzevLY6RW+wNQmx5xDS2XcnkJM70gX0Nasno/FaqMuDktUDE0L4 X5V/Jk0rbxyG8UF7Mzf41cxeuGhGWa2d73pd7SM1M0aKk84Pr3njhUcTFD/70I4NNhC2 +KEbvEGlEzKHqNdJb3XyyygpoUuVvvwLWOd3BgGB9ESG8R/V38nAdWv+wHtQkQCwtEaB +154h6OryOvII+SQoXi8eVYTWRHJtnHlA6PSm+Xik/SSQQ0T83YBZmbjryDIx2I/edVK Ma7sAkmZiVnkd8dSnB17u6ZPVquAcOOcYATnnw+29hsVP+ACLlnLo7wFyq8u4Goyqm8J KJuw== X-Gm-Message-State: AOAM533h0F3pMCoQVYeRq2xbpWs3SU+3A9zM0Gjws8/PADxpH1pHH++X KuV2F8l7ldjpX8LNgW7f/MDNrxa0gx3BrnIl40U= X-Google-Smtp-Source: ABdhPJwzvlkdGDmRRSyUCOPNyWMDdU8P8PjUtphlIl9fYuigJtEbM9vIrE5QzZlM/yhzv5e/OJ2BkXpNiag9I+KhdEM= X-Received: by 2002:a2e:504b:: with SMTP id v11mr9942240ljd.13.1625461688232; Sun, 04 Jul 2021 22:08:08 -0700 (PDT) In-Reply-To: <878s2lidp1.fsf@zoho.eu> Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=hongyi.zhao@gmail.com; helo=mail-lj1-x22a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131470 Archived-At: On Mon, Jul 5, 2021 at 12:32 PM Emanuel Berg via Users list for the GNU Emacs text editor 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 Theory and Simulation of Materials Hebei Vocational University of Technology and Engineering NO. 552 North Gangtie Road, Xingtai, China