bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33998: 27.0.50; cl-delete does not delete the first list element


From: João Távora
Subject: bug#33998: 27.0.50; cl-delete does not delete the first list element
Date: Tue, 08 Jan 2019 21:38:17 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

> It's not about implementation of `cl-delete'. It's
> not about the type of sequence you pass it.  It's
> about a variable being something different from its
> value.

Drew, it is you who are missing something basic here:

  (defun mistery (thing seq)
    (let ((head (elt seq 0)))
      (cl-delete thing seq)
      (eq head (elt seq 0))))

Today, in Emacs this always returns t, for every THING and sequence SEQ
you can think of (in fact, for vectors, cl-delete delegates to cl-remove).
This is perfectly CL-compliant.  But a future, different, also perfectly
CL-compliant, implementation of cl-delete, might very well make this
function return nil.  In fact, if you port this code to SBCL or Allegro
CL by changing 'cl-delete' to 'cl:delete'

  (mistery 1 (list 1 2 3 4)) ;; => t
  (mistery 1 (vector 1 2 3 4)) ;; => nil

So again, for the nth time, it's a bad idea to rely on SEQ after calling
'cl-delete'.

João










reply via email to

[Prev in Thread] Current Thread [Next in Thread]