Subject: bug#52383: 29.0.50; [suggestion] Add seq-set-subset-p to seq.el

From: Marco Wahl <[email-masked]>
Date: Thu, 09 Dec 2021 01:55:13 +0100

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