From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#33998: 27.0.50; cl-delete does not delete the first list element Date: Mon, 07 Jan 2019 21:06:44 +0000 Message-ID: <87a7kcmb2z.fsf@gmail.com> References: <87muodud4d.fsf@aia00054aia.gr> <877efgte1k.fsf@aia00054aia.gr> <219daf3c-1341-a2aa-6d0e-6388c4a3184b@yandex.ru> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1546895104 14697 195.159.176.226 (7 Jan 2019 21:05:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 Jan 2019 21:05:04 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 33998@debbugs.gnu.org, Deus Max To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 07 22:05:00 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggc4x-0003f8-W1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jan 2019 22:05:00 +0100 Original-Received: from localhost ([127.0.0.1]:56204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggc75-0002FL-02 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jan 2019 16:07:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:40002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggc6x-0002EE-4o for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2019 16:07:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggc6w-0003dz-Ap for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2019 16:07:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggc6w-0003dm-7A for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2019 16:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ggc6v-0007I6-S0 for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2019 16:07:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Jan 2019 21:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33998 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33998-submit@debbugs.gnu.org id=B33998.154689521528014 (code B ref 33998); Mon, 07 Jan 2019 21:07:01 +0000 Original-Received: (at 33998) by debbugs.gnu.org; 7 Jan 2019 21:06:55 +0000 Original-Received: from localhost ([127.0.0.1]:48998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggc6p-0007Hm-6x for submit@debbugs.gnu.org; Mon, 07 Jan 2019 16:06:55 -0500 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:55856) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ggc6m-0007HY-La for 33998@debbugs.gnu.org; Mon, 07 Jan 2019 16:06:53 -0500 Original-Received: by mail-wm1-f42.google.com with SMTP id y139so2132702wmc.5 for <33998@debbugs.gnu.org>; Mon, 07 Jan 2019 13:06:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=tizPwq9D5tHa8pSvJNpyQ2EcoXemAC90suerIgFYKbk=; b=LQypLFfzDVI9hNMlG/CiSXD8McrPmuyCGqrEM32I1UYdTlRXF5xaUVaHFzJBrW75wV TR25ajj7Hw2YxDMpSU1skEV6mVW9SoRGKa8mBP7IJpbrNUZQd7wNAy0rB08Wvke/6Dht 1p9TQdzQFwtoKkASYuL8BAr/nxSb5q2IKm6gvwRNU/A+OJC0Xsd+dpqNAhhmo/kI/2Hr sqaa6qcHSekb4N5iMJ/at/Q51XuM86NLt+u03Kok0h41g6jBRWi7xezqqXdliCUgz+nq x5mElTegfl2oqIhwk1N4kXgORdbV90Ju8Fe4eTfJ4mmub2UaqCB6oI+yPTFncWvd5pqa zt5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=tizPwq9D5tHa8pSvJNpyQ2EcoXemAC90suerIgFYKbk=; b=GMsDdlO+Qi+yehSW34884kkky+PxeSdMM65lI1G/+dLZpZcR7R6DhjzYt9rBv1elJ7 bhubtdI7Vg1DsQbFr9BbqYhBMEWXhr/6Mjf2mlDsPSUowSi2iMKDs/nwIga5sBUtt/rh B5u9O21EUYUgWreRAXzNRkuypHdQUbE4AEgPZ1EFLNdw9W+xv6FeNDw6PmFnQxAxNwni He2tIMD0M8Io8F5dCYz25dpN0d4mZH3p8tFJY6z27R65PhYfYFAd4Nb4VXSv0cLa95RQ aS2rMkHthabgouJxGWHqrg4e5fro/1Xn4+zwi9nbsd3VkFiniXweRsuPLgTOojPNK/E+ gl7w== X-Gm-Message-State: AJcUukdin68V+U8kljaK6M3pjVvMR/G2MsBxxEsLOpgwbWztlfHOmHOV K41WZA66ec4nIcC8uBx8jJZVR0zv X-Google-Smtp-Source: ALg8bN4weIy+FbPQ7cZR/98wb3reyWUuEqZY+ZItu3l667Js1hK31WSGU4C8PexEJ5Y2HlvNGTA20g== X-Received: by 2002:a1c:2e0c:: with SMTP id u12mr9893369wmu.81.1546895206594; Mon, 07 Jan 2019 13:06:46 -0800 (PST) Original-Received: from lolita.yourcompany.com (188.139.62.94.rev.vodafone.pt. [94.62.139.188]) by smtp.gmail.com with ESMTPSA id v6sm42476235wro.57.2019.01.07.13.06.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 13:06:45 -0800 (PST) In-Reply-To: <219daf3c-1341-a2aa-6d0e-6388c4a3184b@yandex.ru> (Dmitry Gutov's message of "Mon, 7 Jan 2019 23:27:34 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:154233 Archived-At: Dmitry Gutov writes: > On 07.01.2019 23:20, Deus Max wrote: >> The variable you pass is modified. > > The value. Not the variable. The latter keeps pointing at whatever > cons it's pointed before. What Dmitry said, let me just add this: what you call variables in Lisp are actually symbols that, among other things, may (or may not) have a "variable binding" (this is why you sometimes get "unbound" errors when you try to evaluate a symbol's variable value). They are indeed pointers. So if you read "destructive" as in "modify a variable's binding, i.e. the place where it points to" then no *function* can do that when passed the variable, because what it is receiving is the value pointed to by the symbol. A macro, like 'setq' or 'pop' can do that, because it "sees" the symbol. An alternative place to read on Common Lisp's DELETE is Common Lisp's hyperspec: http://www.lispworks.com/documentation/HyperSpec/Body/f_rm_rm.htm The "may modify sequence" sentence figures prominently there. Emacs's cl-delete attempts to emulate Common Lisp's CL:DELETE. In Emacs it behaves, in this regard, no different from delete or delq. It is "potentially destructive" because it *may* modify the *structure* of the sequence *value* that you pass to it, be it a linked list or a vector: 1) If it is a linked list, it does the trick of making the pointer before the element you want to delete point to the element after it; 2) If it is a vector, it moves all the vector elements after the one you want to delete back one position and readjusts the vector size. If you notice, for situation 2 you could theoretically affect the variable binding directly. And curiously, this is where I found differences between Emacs's cl-delete and some CL's implementation of CL:DELETE. Emacs: (setq bla (vector 1 2 3 4)) (delete 1 bla) =3D> [2 3 4] bla =3D> [1 2 3 4] =20=20=20=20=20 (setq bla (vector 1 2 3 4)) (cl-delete 1 bla) =3D> [2 3 4] bla =3D> [1 2 3 4] Allegro common lisp and CMU common lisp: (setq bla (vector 1 2 3 4)) (delete 1 bla) =3D> #(2 3 4)=20 bla =3D> #(2 3 4) SBCL common lisp: (setq bla (vector 1 2 3 4)) (delete 1 bla) =3D> #(2 3 4) bla =3D> #(2 3 4 4) So, for vector sequences, CL:DELETE is apparently allowed to do whatever. Reading the hyperspec, it seems that all these results are correct, even SBCL's. Jo=C3=A3o