From: Deus Max <deusmax@gmx.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: 33998@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#33998: 27.0.50; cl-delete does not delete the first list element
Date: Tue, 08 Jan 2019 00:46:28 +0200 [thread overview]
Message-ID: <87va30rsqj.fsf@aia00054aia.gr> (raw)
In-Reply-To: <87a7kcmb2z.fsf@gmail.com> ("João Távora"'s message of "Mon, 07 Jan 2019 21:06:44 +0000")
On Mon, Jan 07 2019, João Távora wrote:
> 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) => [2 3 4]
> bla => [1 2 3 4]
>
> (setq bla (vector 1 2 3 4))
> (cl-delete 1 bla) => [2 3 4]
> bla => [1 2 3 4]
>
> Allegro common lisp and CMU common lisp:
>
> (setq bla (vector 1 2 3 4))
> (delete 1 bla) => #(2 3 4)
> bla => #(2 3 4)
>
> SBCL common lisp:
>
> (setq bla (vector 1 2 3 4))
> (delete 1 bla) => #(2 3 4)
> bla => #(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ão
Wow! thanks for clarifying the points.
I had to fire up my SBCL to see it !
prev parent reply other threads:[~2019-01-07 22:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-06 13:30 bug#33998: 27.0.50; cl-delete does not delete the first list element Deus Max
2019-01-07 17:13 ` João Távora
2019-01-07 17:28 ` Drew Adams
2019-01-07 18:04 ` João Távora
2019-01-07 18:14 ` Drew Adams
2019-01-08 13:45 ` João Távora
2019-01-08 18:22 ` Drew Adams
2019-01-08 18:31 ` João Távora
2019-01-08 18:45 ` Drew Adams
2019-01-08 18:57 ` João Távora
2019-01-08 19:07 ` Drew Adams
2019-01-08 21:38 ` João Távora
2019-01-09 1:30 ` Drew Adams
2019-01-07 20:20 ` Deus Max
2019-01-07 20:27 ` Dmitry Gutov
2019-01-07 20:48 ` Deus Max
2019-01-07 21:06 ` João Távora
2019-01-07 22:46 ` Deus Max [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87va30rsqj.fsf@aia00054aia.gr \
--to=deusmax@gmx.com \
--cc=33998@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=joaotavora@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).