From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.bugs Subject: bug#7088: `copy-tree' of a vector copy sharing structure.with original Date: Fri, 24 Sep 2010 01:19:13 -0400 Message-ID: References: <4C9BBB7A.2060004@harpegolden.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1285306880 2737 80.91.229.12 (24 Sep 2010 05:41:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Sep 2010 05:41:20 +0000 (UTC) Cc: 7088@debbugs.gnu.org, Andreas Schwab To: David De La Harpe Golden Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 24 07:41:18 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz126-00019J-3w for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Sep 2010 07:41:18 +0200 Original-Received: from localhost ([127.0.0.1]:52288 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz125-0003Ns-Dv for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Sep 2010 01:41:17 -0400 Original-Received: from [140.186.70.92] (port=38672 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz11u-0003N1-KA for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 01:41:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz11t-0008LM-4v for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 01:41:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35388) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz11s-0008LG-Sj for bug-gnu-emacs@gnu.org; Fri, 24 Sep 2010 01:41:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Oz0ec-0001OR-DC; Fri, 24 Sep 2010 01:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: MON KEY Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Sep 2010 05:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7088 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7088-submit@debbugs.gnu.org id=B7088.12853053985343 (code B ref 7088); Fri, 24 Sep 2010 05:17:02 +0000 Original-Received: (at 7088) by debbugs.gnu.org; 24 Sep 2010 05:16:38 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz0eD-0001O8-Ma for submit@debbugs.gnu.org; Fri, 24 Sep 2010 01:16:37 -0400 Original-Received: from mail-wy0-f172.google.com ([74.125.82.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz0eC-0001O3-3x for 7088@debbugs.gnu.org; Fri, 24 Sep 2010 01:16:36 -0400 Original-Received: by wyi11 with SMTP id 11so2187276wyi.3 for <7088@debbugs.gnu.org>; Thu, 23 Sep 2010 22:19:14 -0700 (PDT) Original-Received: by 10.216.44.141 with SMTP id n13mr1677968web.16.1285305554686; Thu, 23 Sep 2010 22:19:14 -0700 (PDT) Original-Received: by 10.216.67.195 with HTTP; Thu, 23 Sep 2010 22:19:13 -0700 (PDT) In-Reply-To: <4C9BBB7A.2060004@harpegolden.net> X-Google-Sender-Auth: VtHCrS-VGo4YI1V4li1yeULyxN8 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 24 Sep 2010 01:17:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40388 Archived-At: On Thu, Sep 23, 2010 at 4:41 PM, David De La Harpe Golden wrote: > On 23/09/10 06:28, MON KEY wrote: >> >> (let ((orig [[a b] [c d] [e f] [g h]]) >> new-cp) >> (setq new-cp (copy-tree orig)) > > Some people would have at least considered a quick C-h f copy-tree > before filing a bug? > > You're missing the VECP arg to emacs lisp copy-tree. > (let ((orig '((a . b) [c d] [e f] [g h])) new-cp) (setq new-cp (copy-tree orig)) (string-equal (elt (elt (prog1 orig (aset (elt new-cp 1) 0 "bubba")) 1) 0) "bubba")) ;=> t The VECP arg wasn't needed in order to copy the vector only to prevent the copy from sharing structure... This isn't at all clear in the docs. (let ((orig [(a . b) [c d] [e f] [g h]]) new-cp) (setq new-cp (copy-tree orig t)) (string-equal (cdr (elt (prog1 orig (setf (cdr (elt new-cp 0)) "bubba")) 0)) "bubba")) ;=> nil > Without that, emacs lisp copy-tree is, much like common lisp copy-tree, > documented to copy trees of _conses_. Conses do of course look pretty like > 2 element vectors, but they are a separate datatype in emacs lisp. > OK. Thank you for taking the time to clarify this. I read the doc 3 or 4 times and glanced at the sources and it wasn't clear what the intent of the VECP (a non-predicate BTW) is intended to accomplish. Maybe a copy-vector would be better instead of lumping the datatypes together. Anyhow, sorry for the noise. -- /s_P\