GNU bug report logs -
#52383
29.0.50; [suggestion] Add seq-set-subset-p to seq.el
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 3 years and 248 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.