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: using setq to create lists based on other lists... Date: Sun, 2 Dec 2018 19:53:35 +0900 Message-ID: <5C1642CD-F485-47CF-88B9-41D7960DDE80@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 12.1 \(3445.101.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1543747932 7109 195.159.176.226 (2 Dec 2018 10:52:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 2 Dec 2018 10:52:12 +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 11:52:08 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 1gTPM8-0001kI-2V for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2018 11:52:08 +0100 Original-Received: from localhost ([::1]:44057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTPOE-0001Zq-FI for geh-help-gnu-emacs@m.gmane.org; Sun, 02 Dec 2018 05:54:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTPNh-0001Zh-8n for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 05:53:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTPNe-0003hD-5O for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 05:53:45 -0500 Original-Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:46037) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTPNd-0003h3-Vx for help-gnu-emacs@gnu.org; Sun, 02 Dec 2018 05:53:42 -0500 Original-Received: by mail-pg1-x534.google.com with SMTP id y4so4408108pgc.12 for ; Sun, 02 Dec 2018 02:53:41 -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:message-id:date :to; bh=FYw0TNDPLua0EAygLbelemWIyGiS/RK+N5PP/Hg7k90=; b=Mn36yC0kyZocHhGrQq0Qj67xf/PVByJbjPtTibwUDU+PK+h1PW1qcHFmGn1Nkx/pye qJ21pRGCM7thYKOZbP2ow6ghSLAlGqmeXaX6wv5z3wttvXxjMyKskXXL4BB6k/8qGHGR i29sh/6bT5lPXhzTVOxIh7gEeJtUVK3ZCSKioTihygd0d9Frj5seW1K2uzjySUdDmejH WofDgz3C+aZbpYJdyfWdUuzLBWFVRfiVSvQhYmhHIpUnkaLMfIxvDK/UTAeWNCdVEZ0G l8H1umf9AqzRy5a1KMdBUf3ZI5tmbxQXklA9stL3Fjlc1cASl/Kh+x8owjFyHu2v/IoX AmhQ== 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:message-id:date:to; bh=FYw0TNDPLua0EAygLbelemWIyGiS/RK+N5PP/Hg7k90=; b=DpIoAJATCItHmdYTp/QwKllSZNwbzKfNtuISHqrCcaU0TpT5rUzpP6R/VUFDCAG07l eC2bJX1icdmq9ffMjdIpTiMMAapEuOIEfm4w4hD9alFuhNIJjTn+IO9oQKNzyj7Qy4gd pk9T465dJoMB+8M9wky/XuaTowcwkbFJ2+aG8+KgMYNAy8AWqyeXHyRBSnf4EVmwy8HR hQXSlhWzDqw5vaTHHZzgRirxh+5rWW03idgntQCQJsQrzh9mlzvfIdcs7emZokAQfP7f oOGNOPq5gGL4TSsMj/1n/Wssh15o/m10to2dli5IK5KfGZyDtLuzqftP5pabljIBIPDv ojSw== X-Gm-Message-State: AA+aEWZOoFC64Hkmkr/aNNG7nMciOSDcnpHHDgINm7H1gTRQfXE6s8G2 XITFzHpgKoA7KyEZdDhnUKGOoqQK X-Google-Smtp-Source: AFSGD/WbNsdN4QwkEuogF0BowwRrAvqqu6uQ2oxjVAaw3Ih1m8GZQNsIOAmag+A3+DaSe2dbP2kY0g== X-Received: by 2002:a65:49cd:: with SMTP id t13mr10120756pgs.376.1543748020305; Sun, 02 Dec 2018 02:53:40 -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 6sm13516072pfv.30.2018.12.02.02.53.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Dec 2018 02:53:39 -0800 (PST) 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:118818 Archived-At: I spend most of the day investigating why creating a list with setq was = not "working". For ex: (setq list0 '(1 2)) (setq list1 list0) If you do (setcar list0 0) then for some reason (for which I could not find an explanation in the = elisp reference) the car of list1 also changes, and vice-versa. Which is totally unexpected since when you do: (setq list0 0) list1 does not become 0 I don't suppose that's a bug, but really it ought the be very clearly = documented in the reference. Also, I'd like to know why that's = happening. So, to avoid that behavior, I had to resort to using copy-tree: (setq list1 (copy-tree list0)) Which is really not the first thing I would have thought about. There are probably better ways to create lists based on other lists = without "linking" the two, so I'd like some information about that. Thanks in advance. Jean-Christophe Helary ----------------------------------------------- http://mac4translators.blogspot.com @brandelune