From: Drew Adams <drew.adams@oracle.com>
To: 28876@debbugs.gnu.org
Subject: bug#28876: 26.0; (elisp) `Hash Tables': hash table vs alist
Date: Tue, 17 Oct 2017 08:45:49 -0700 (PDT) [thread overview]
Message-ID: <7b57e08d-96a4-4887-bd25-afe9e9587c09@default> (raw)
1. Please consider saying explicitly that an Elisp hash table is not a
multimap.
This is another way in which it differs from an alist. An alist can
have multiple entries that have exactly the same key (even `eq'). An
Elisp hash table cannot - it realizes a mathematical function: one key
gives you only one value.
(The fact that `assoc' and `assq' ignore entries past the first is
irrelevant here. An alist is a list; it can be used in many ways.)
2. Wrt the difference between an alist and a hash table, the emphasis in
this node seems to be on the performance characteristics. I think that
functional/structural differences should be distinguished here from
performance differences, instead of just lumping them together in the
same bulleted list.
From the perspective of using a hash table, certainly the performance
(as well as the non-multimap characteristic) is important, and often
decisive. But from the perspective of using an alist, the structure (as
well as the multimap characteristic) is also important: Lisp programs
manipulate alists as lists - they do not necessarily just use `assoc' or
`assq' on them.
This node seems to have been written by a hash table-only user, not a
general Lisp user, who might use both hash tables and alists. Please
consider expanding the description of the difference between the two,
which means expanding on what is said about alists.
I recognize that the main purpose of this node is to describe/introduce
hash tables. But this is Lisp, so I think it is important to _really_
describe how a hash table differs, in its use, from an alist. An alist
is a more general thingy - you can use it in ways that you cannot use a
hash table. That BIG difference does not come across in this node, so
far.
In GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32)
of 2017-10-13
Repository revision: 906224eba147bdfc0514090064e8e8f53160f1d4
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
next reply other threads:[~2017-10-17 15:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 15:45 Drew Adams [this message]
2019-10-09 8:33 ` bug#28876: 26.0; (elisp) `Hash Tables': hash table vs alist Lars Ingebrigtsen
2019-10-09 14:47 ` 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=7b57e08d-96a4-4887-bd25-afe9e9587c09@default \
--to=drew.adams@oracle.com \
--cc=28876@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.