From: Drew Adams <drew.adams@oracle.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 45539@debbugs.gnu.org
Subject: bug#45539: 26.3; `add-to-ordered-list': Add optional arg for :test predicate for hash table
Date: Wed, 30 Dec 2020 21:47:45 -0800 (PST) [thread overview]
Message-ID: <97ab6ba6-210a-4b72-9350-00e30c28d0e1@default> (raw)
In-Reply-To: <87r1n6oawn.fsf@gnus.org>
> > It's a strange, maximally inefficient function. I'll fix it up a bit
> > and add the test-function.
>
> The complication is that test-function has to be the same in all calls
> (or not given at all in subsequent calls).
I don't think so. It just needs to be applicable
for the particular kind(s) of list elements you
have.
I think you can use different TEST functions, but
I'm not sure why you'd do that.
But you raise a good point. Because TEST needs to
be used to test list membership, as well as to be
the hash-table :test, unless the default value for
it suffices for testing list membership you need
to provide it whenever you call the function.
That's not good, and it's maybe one reason the
design hard-coded `eq'.
OK, I see now that there's `hash-table-test', which
returns the :test defined for the hash table. We
should use that, not TEST, each time for checking
list membership, I think.
IOW, not this:
(unless (cl-member element (symbol-value list-var) :test TEST)
(set list-var (cons element (symbol-value list-var))))
but this:
(unless (cl-member element (symbol-value list-var)
:test (hash-table-test ordering))
(set list-var (cons element (symbol-value list-var))))
next prev parent reply other threads:[~2020-12-31 5:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-29 21:04 bug#45539: 26.3; `add-to-ordered-list': Add optional arg for :test predicate for hash table Drew Adams
2020-12-30 3:48 ` Lars Ingebrigtsen
2020-12-30 7:01 ` Drew Adams
2020-12-30 7:07 ` Lars Ingebrigtsen
2020-12-30 8:43 ` Drew Adams
2020-12-30 17:55 ` Drew Adams
2020-12-31 3:55 ` Lars Ingebrigtsen
2020-12-31 4:30 ` Lars Ingebrigtsen
2020-12-31 5:47 ` Drew Adams [this message]
2020-12-31 16:40 ` Drew Adams
2020-12-31 5:34 ` Drew Adams
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=97ab6ba6-210a-4b72-9350-00e30c28d0e1@default \
--to=drew.adams@oracle.com \
--cc=45539@debbugs.gnu.org \
--cc=larsi@gnus.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.