all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Unknown <unknown@unknown.invalid>
To: Stefan Kangas <stefan@marxist.se>
Cc: 44205@debbugs.gnu.org
Subject: bug#44205: [PATCH] Add new function seq-remove-item
Date: Sun, 25 Oct 2020 17:25:02 +0100	[thread overview]
Message-ID: <m1sga29std.fsf@yahoo.es> (raw)
In-Reply-To: <CADwFkmnygDtrTEHqWVJ1watMswR8NPy_XAioa5rh8bKNyqbMeA@mail.gmail.com> (Stefan Kangas's message of "Sat, 24 Oct 2020 17:52:04 -0700")

Stefan Kangas <stefan@marxist.se> writes:

> I found myself reaching for a version of `seq-remove' where I don't have
> to supply a lambda but can just give an item.  Ergo, the attached.
>
>     (seq-remove-item 2 '(1 2 3))  => (1 3)
>
> I find it a whole lot nicer than:
>
>     (seq-remove (lambda (a) (= a 2)) '(1 2 3))  => (1 3)
>
> Turns out it could already be used to simplify some code in tab-line.el,
> even if seq is arguably not yet very widely used in our sources.
>
> I did not yet add it to NEWS or the manual; I will do that if people
> agree that this is a good addition.
>
> Comments?

I don't see a clear need for this new function, because there's already

(delete 2 '(1 2 3)) -> Destructs the original list, compares with equal.
(remove 2 '(1 2 3)) -> Keeps the original list, compares with equal.
(delq 2 '(1 2 3)) -> Destructs the argument list, compares with eq.
(remq 2 '(1 2 3)) -> Keeps the original list, compares with eq.

Maybe we could add or improve cross-references in the documentation so
that these functions are more discoverable?





  parent reply	other threads:[~2020-10-25 16:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25  0:52 bug#44205: [PATCH] Add new function seq-remove-item Stefan Kangas
2020-10-25 12:49 ` Lars Ingebrigtsen
2020-10-27 13:36   ` Basil L. Contovounesios
2020-11-13  0:07     ` Stefan Kangas
2020-11-18 17:17       ` Stefan Kangas
2020-10-25 16:25 ` Unknown [this message]
2020-10-25 19:12 ` Juri Linkov
2020-10-27 13:45 ` Basil L. Contovounesios

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1sga29std.fsf@yahoo.es \
    --to=unknown@unknown.invalid \
    --cc=44205@debbugs.gnu.org \
    --cc=stefan@marxist.se \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.