From: Drew Adams <drew.adams@oracle.com>
To: Omar Polo <op@omarpolo.com>, Thien-Thi Nguyen <ttn@gnuvola.org>
Cc: help-gnu-emacs@gnu.org
Subject: RE: cl-delete-if vs list of overlays
Date: Wed, 9 Dec 2020 08:14:00 -0800 (PST) [thread overview]
Message-ID: <37eda673-f866-4116-8d75-10231da38b28@default> (raw)
In-Reply-To: <87wnxrfdea.fsf@omarpolo.com>
> I was under the (wrong) assumption that a destructive function will
> always modify the list, when it's not the case. I needed to setq the
> result of cl-delete-if to the list itself to cover all the cases.
Yes. When you pass a list-valued variable to a "destructive"
function you pretty much always want to set the variable to
the result.
`C-h i' Elisp manual `i destructive list operations'
And `g Sets and Lists' tells us, about using `delq':
Don’t assume that a variable which formerly held the
argument LIST now has fewer elements, or that it still
holds the original list! Instead, save the result of
‘delq’ and use that. Most often we store the result
back into the variable that held the original list:
next prev parent reply other threads:[~2020-12-09 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 9:53 cl-delete-if vs list of overlays Omar Polo
2020-12-09 10:17 ` Thien-Thi Nguyen
2020-12-09 11:05 ` Omar Polo
2020-12-09 16:14 ` Drew Adams [this message]
2020-12-09 18:16 ` Thien-Thi Nguyen
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=37eda673-f866-4116-8d75-10231da38b28@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=op@omarpolo.com \
--cc=ttn@gnuvola.org \
/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.
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).