GNU bug report logs -
#28753
25.3; Functions to get alist from hash table and vice versa
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Mon, 9 Oct 2017 00:27:02 UTC
Severity: wishlist
Found in version 25.3
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 28753 <at> debbugs.gnu.org (full text, mbox):
On Thu, Oct 12, 2017 at 9:27 AM, Nicolas Petton <nicolas <at> petton.fr> wrote:
> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
>>> Actually, going from alist to hash table doesn't look so
>>> useful with `map-into'. A caller should be able to specify
>>> the hash-table parameters (features), such as :test.
>>
>> Yeah, that's what I thought, too.
>
> That's something I can easily add. `map-into' would then look like
> the following `(defun map-into (map type &rest keywords))'.
>
> However, `keywords' would be ignored when converting to an alist. I'm
> not sure I like it.
What about just receiving the hash-table as a parameter:
(defun map-into (map type)
"Convert the map MAP into a map of type TYPE.
TYPE can be one of the following symbols: `list', `hash-table'; or it
can be a hash-table to use.
MAP can be a list, hash-table or array."
(pcase type
(`list (map-pairs map))
(`hash-table (map--into-hash-table map))
((pred hash-tablep) (map--into-existing-hash-table map type)
(_ (error "Not a map type name: %S" type)))))
(defun map--into-existing-hash-table (map hash-table)
...)
This bug report was last modified 3 years and 32 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.