[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44205: [PATCH] Add new function seq-remove-item
From: |
Juri Linkov |
Subject: |
bug#44205: [PATCH] Add new function seq-remove-item |
Date: |
Sun, 25 Oct 2020 21:12:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> 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)
There is no name 'item' used in function names of seq.el. The term used
here is 'elt', so maybe 'seq-remove-elt' would be a better name.
> 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.
The initial versions of tab-line.el used a more complex condition,
but now a simpler remove/remq could be used instead.