From: Marco Wahl <marcowahlsoft@gmail.com>
To: 52383@debbugs.gnu.org
Subject: bug#52383: 29.0.50; [suggestion] Add seq-set-subset-p to seq.el
Date: Thu, 09 Dec 2021 01:55:13 +0100 [thread overview]
Message-ID: <87mtlaiolq.fsf@gmail.com> (raw)
I suggest adding seq-set-subset-p to seq.el to realize the typical math
subset predicate.
(cl-defgeneric seq-set-subset-p (sequence1 sequence2 &optional testfn)
"Return non-nil if the elements of SEQUENCE1 are contained in SEQUENCE2.
This does not depend on the order of the elements.
Equality is defined by TESTFN if non-nil or by `equal' if nil."
(seq-every-p (lambda (item1) (seq-contains-p sequence2 item1 testfn)) sequence1))
;; test:
(should (seq-set-subset-p "ab" "abc"))
(should (seq-set-subset-p "ba" "abc"))
(should-not (seq-set-subset-p "dabc" "abc"))
That functionality is missing AFAICS.
The function could be placed naturally between the functions `seq-contains-p'
and `seq-set-equal-p'.
BTW function `seq-set-equal-p' could be rewritten using
`seq-set-subset-p'.
Thanks for reading,
--
Marco
next reply other threads:[~2021-12-09 0:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 0:55 Marco Wahl [this message]
2021-12-09 9:01 ` bug#52383: 29.0.50; [suggestion] Add seq-set-subset-p to seq.el Juri Linkov
2021-12-09 20:21 ` Marco Wahl
2021-12-09 20:29 ` Juri Linkov
2021-12-09 21:23 ` Marco Wahl
2021-12-10 1:45 ` Michael Heerdegen
2021-12-10 12:01 ` Lars Ingebrigtsen
2021-12-11 18:40 ` Juri Linkov
2021-12-12 1:19 ` Michael Heerdegen
2021-12-12 4:57 ` Lars Ingebrigtsen
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=87mtlaiolq.fsf@gmail.com \
--to=marcowahlsoft@gmail.com \
--cc=52383@debbugs.gnu.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.
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.