GNU bug report logs -
#52383
29.0.50; [suggestion] Add seq-set-subset-p to seq.el
Previous Next
To reply to this bug, email your comments to 52383 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Thu, 09 Dec 2021 00:56:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Marco Wahl <marcowahlsoft <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 09 Dec 2021 00:56:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Thu, 09 Dec 2021 09:05:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 52383 <at> debbugs.gnu.org (full text, mbox):
> BTW function `seq-set-equal-p' could be rewritten using
> `seq-set-subset-p'.
Isn't the word "set" redundant in the name?
In `seq-set-equal-p' the word "set" is needed
to say "is set equal". But in `seq-set-subset-p'
the word "set" doesn't add much meaning, so better
would be to name your new function just `seq-subset-p'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Thu, 09 Dec 2021 20:22:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> BTW function `seq-set-equal-p' could be rewritten using
>> `seq-set-subset-p'.
>
> Isn't the word "set" redundant in the name?
> In `seq-set-equal-p' the word "set" is needed
> to say "is set equal". But in `seq-set-subset-p'
> the word "set" doesn't add much meaning, so better
> would be to name your new function just `seq-subset-p'.
Agreed.
The motivation for the suggested name `seq-set-subset-p' was to stay
close to the name `seq-set-equal-p'. A user could interpret the prefix
"seq-set" as hint that the function implements a set operation.
Thanks!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Thu, 09 Dec 2021 20:31:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 52383 <at> debbugs.gnu.org (full text, mbox):
>>> BTW function `seq-set-equal-p' could be rewritten using
>>> `seq-set-subset-p'.
>>
>> Isn't the word "set" redundant in the name?
>> In `seq-set-equal-p' the word "set" is needed
>> to say "is set equal". But in `seq-set-subset-p'
>> the word "set" doesn't add much meaning, so better
>> would be to name your new function just `seq-subset-p'.
>
> Agreed.
>
> The motivation for the suggested name `seq-set-subset-p' was to stay
> close to the name `seq-set-equal-p'. A user could interpret the prefix
> "seq-set" as hint that the function implements a set operation.
I guess the only reason why `seq-set-equal-p' has the prefix `seq-set-'
is because it would be too ambiguous without the prefix: `seq-equal-p'.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Thu, 09 Dec 2021 21:24:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
>> The motivation for the suggested name `seq-set-subset-p' was to stay
>> close to the name `seq-set-equal-p'. A user could interpret the prefix
>> "seq-set" as hint that the function implements a set operation.
>
> I guess the only reason why `seq-set-equal-p' has the prefix `seq-set-'
> is because it would be too ambiguous without the prefix: `seq-equal-p'.
I guess so too.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Fri, 10 Dec 2021 01:46:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Marco Wahl <marcowahlsoft <at> gmail.com> writes:
> I suggest adding seq-set-subset-p to seq.el to realize the typical
> math subset predicate.
If I recall correctly, Stefan wanted a set.el library. I only want to
mention that, because... well, it's related (and we already found that
"subsequence" testing is not what this implements).
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Fri, 10 Dec 2021 12:02:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> If I recall correctly, Stefan wanted a set.el library. I only want to
> mention that, because... well, it's related (and we already found that
> "subsequence" testing is not what this implements).
Yes, I'd rather have a set.el than adding some set commands to seq.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Severity set to 'wishlist' from 'normal'
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Sat, 11 Dec 2021 01:31:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Sat, 11 Dec 2021 18:53:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 52383 <at> debbugs.gnu.org (full text, mbox):
>> If I recall correctly, Stefan wanted a set.el library. I only want to
>> mention that, because... well, it's related (and we already found that
>> "subsequence" testing is not what this implements).
>
> Yes, I'd rather have a set.el than adding some set commands to seq.
There are already some commands in seq that look like set commands:
seq-union, seq-intersection, seq-difference.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Sun, 12 Dec 2021 01:20:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Juri Linkov <juri <at> linkov.net> writes:
> There are already some commands in seq that look like set commands:
> seq-union, seq-intersection, seq-difference.
Yes, but that's unfortunate, and we need to stop at some point. These
functions also don't really fit in seq.el.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#52383
; Package
emacs
.
(Sun, 12 Dec 2021 04:59:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 52383 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>> There are already some commands in seq that look like set commands:
>> seq-union, seq-intersection, seq-difference.
>
> Yes, but that's unfortunate, and we need to stop at some point. These
> functions also don't really fit in seq.el.
And they're too slow to be used for even smallish sets. So we should
grow a set.el library that is more efficient CPU-wise. (The set
functions in seq.el are efficient RAM-wise, though.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
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.