bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#28876: 26.0; (elisp) `Hash Tables': hash table vs alist


From: Lars Ingebrigtsen
Subject: bug#28876: 26.0; (elisp) `Hash Tables': hash table vs alist
Date: Wed, 09 Oct 2019 10:33:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

> 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.)

An alist is a list that associates keys with value.  There may be
several identical keys in the list, but that is not how an alist is
meant to be used, which is reflected in how the common operators on
alists work -- they only return the first match.

So I don't think this is a difference that needs to be pointed out here.

> 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.

The primary difference is in the performance characteristics, so I don't
see anything that needs changing in that node.  Closing.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]