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

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

RE: cl-delete-if vs list of overlays


From: Drew Adams
Subject: RE: cl-delete-if vs list of overlays
Date: Wed, 9 Dec 2020 08:14:00 -0800 (PST)

> 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:






reply via email to

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