From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Jean-Christophe Helary Newsgroups: gmane.emacs.help Subject: Re: using setq to create lists based on other lists... Date: Sun, 2 Dec 2018 21:22:54 +0900 Message-ID: References: <874lbw4059.fsf@gmx.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1543753282 30357 195.159.176.226 (2 Dec 2018 12:21:22 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Dec 2018 12:21:22 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 02 13:21:18 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gTQkQ-0007kq-FS for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2018 13:21:18 +0100 Original-Received: from localhost ([::1]:44283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTQmW-00084B-NS for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2018 07:23:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTQm6-00083v-OD for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 07:23:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTQm3-0007Yr-Fv for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 07:23:02 -0500 Original-Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:40069) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTQm3-0007X5-9v for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 07:22:59 -0500 Original-Received: by mail-pg1-x534.google.com with SMTP id z10so4463319pgp.7 for ; Sun, 02 Dec 2018 04:22:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=NP88RIpJP43Z6iEF1jJseOR9oUJ8+vs+JB5mxvafUvg=; b=kLuPmw0AqodSUcZNZ49QNTENMiQXJnsUbiZl/pNbrOG4RLnwztGtlNxQZE2hRvUTBk HZdm3R1J3T18KZok7FsQa4nwCHW7+6G2qldg5oqQJDB6W4d0DjrBdiqyGaEbDAAqcUXt +OWMNBWvFIU76PETg2ADtIBFs0kN1RQMPKsjhL+PRxNt31W92QQIfHjFgJeZA+vQlL5F qg3ATWshYaSdLqOevUCtCJaQBdNbcmqtwIeFcnfY58G4YV7IyGdJRkaIO71cT+Lw+9ZT 1pUSvNvLxuFOGxigGmcKCP+gSao0f5DKuJfiXpz6vmglmTkNIIugTYQL9B7TIVjRnkxN ZyDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=NP88RIpJP43Z6iEF1jJseOR9oUJ8+vs+JB5mxvafUvg=; b=H79NHhTtQABIiAgFX5eYCPdKj4yoCYwWqf8uauN0rCGUOrxb9TfsAfiEOD/SK9akdS buDiwImu+f2NBT0LbGp4mPatlOQMXH9KXQM/HTU/S3R6VXuEzysc+8mIsdFT/4ugM0MQ 2+jKe3oaF2BGZIf0YyFq3YTC6gDtdDxVSIRmQfsXtcyACFWFXEm3nIKHwjpthoxEWELu KJ2Ey9yxyLhxKyaziF6WoE276/3qJwMRrxGW1MUDonq1QsY+9HIcj1eLHRnWErUYXyYV zVpwZTS5lT9UK9iCv3hukuHV9GhtV48RUm2oOwR07xgMYQ4eRkltKzAdlmurSGzJ2g6t CFgQ== X-Gm-Message-State: AA+aEWZj82skK5DGjJCRe4kin5GYd9H0cK3cFMUEmOVCeVhMUMOB214E J9U8qoqoOnnVYA1tskm5WdbF9pUT X-Google-Smtp-Source: AFSGD/WLpyVYOGEoLkk8yGVIYK36zGsoY57GX6BRRkMK0BNtZo1V7D87LDJ4302Xcw919I0uqrf/jQ== X-Received: by 2002:a63:f047:: with SMTP id s7mr10110382pgj.441.1543753377740; Sun, 02 Dec 2018 04:22:57 -0800 (PST) Original-Received: from [192.168.1.11] (pl16832.ag0304.nttpc.ne.jp. [128.53.251.192]) by smtp.gmail.com with ESMTPSA id q5sm16825731pfi.165.2018.12.02.04.22.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 04:22:56 -0800 (PST) In-Reply-To: <874lbw4059.fsf@gmx.net> X-Mailer: Apple Mail (2.3445.101.1) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::534 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:118823 Archived-At: Stephen, thank you for the additional explanations. > On Dec 2, 2018, at 20:51, Stephen Berman = wrote: >>> I don't suppose that's a bug, but really it ought the be very = clearly=20 >>> documented in the reference. Also, I'd like to know why that's = happening. >=20 > To expand of this, since Jean-Christophe didn't find an explanation of > this behavior of setq in the Lisp reference, but it is in fact > documented: Well, yes and no. > Special Form: setq [symbol form]... > This special form is the most common method of changing a > variable=E2=80=99s value. Each SYMBOL is given a new value, which = is the > result of evaluating the corresponding FORM. The current binding > of the symbol is changed. >=20 > In the above case, the symbol `list1' is given the result of = evaluating > `list0', which is the list `'(1 2)'. So now both `list0' and `list1' > refer to this list, That's not clear at all from the paragraph you quote. Because for all = practical purposes, when I evaluate list0 I get (1 2) and not "a pointer = to an object that is the list (1 2)". In fact, I just found the explanation, it is in the Introduction to = Emacs Lisp and it says: > When a variable is set to a list with a function such as setq, it = stores the address of the first box in the variable. So, setq has a specific behavior when it applies to lists: it evaluates = the form as a pointer to an object and not as a value. Or am I misunderstanding something ? Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune