GNU bug report logs -
#50927
Considering only entries with unique keys in map.el?
Previous Next
Reported by: Okamsn <okamsn <at> protonmail.com>
Date: Fri, 1 Oct 2021 00:56:01 UTC
Severity: normal
Tags: notabug
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Some kinds of maps, such as alists and plists, can contain duplicate
keys. These duplicates are effectively ignored in functions like
`map-elt`, but are not ignored in functions like `map-do` or `map-length`.
To me, it would make more sense if these functions only considered the
valid entries in the map. For example,
(map-pairs '(a 1 b 2 a 3))
currently returns '((a . 1) (b . 2) (a . 3)), even though '(a . 3) is
meant to be ignored in actual usage, as it is preceded by an earlier
entry with the same key. This is a misleading behavior.
I do not know whether the current behavior is desirable. Is it?
Please consider changing the library so that the duplicate,
meant-to-be-ignored entries are actually ignored for functions that
operate on the entire map.
I have attached an example diff.
Thank you.
[map-uniq.diff (text/x-patch, attachment)]
This bug report was last modified 3 years and 296 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.