Re: Print key-value pairs from both plist and alist

[email protected]
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Heime <[email protected]> writes:

> On Saturday, April 11th, 2026 at 2:44 AM, Heime <[email protected]> wrote:
>
>> I want to print key-value pairs using a function to which I can
>> pass either a plist or an alist as argument.
>> 
>> Have seen different constructs to do so, but is there a clause
>> that will apply for both a plist and an alist?
>
> For hash tables I can use maphash to get key-value pairs.  Is there
> some map equivalent for reading key-value pairs for both plists and
> alists?
>

C-h P map:

   "map.el provides generic map-manipulation functions that work on
    alists, plists, hash-tables, and arrays.  All functions are
    prefixed with "map-"."

Some of the functions in this library:

mapp
  Function: Return non-nil if MAP is a map (alist/plist, hash-table, array,...).

map-keys
  Function: Return the list of keys in MAP.

map-values
  Function: Return the list of values in MAP.

map-do
  Function: Apply FUNCTION to each element of MAP and return nil.

map-elt
  Function: Look up KEY in MAP and return its associated value.

These functions appear not to be documented in an ‘info’
manual so you should use C-h f to read their docstrings.

-- 
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.