Recently I’ve written about Wilfred Hughes’ ht library for dealing with hash tables and Nic Ferrier’s kv library for dealing with alists and plists. Nicolas Petton commented that there is also the map
library, which is built into Emacs as of version 25.2.
What makes Petton’s map
library unique is that the functions will operate on alists, hash tables, or arrays so you don’t need to worry about separate functions for each data type. The functions do the expected things such as getting and putting values, mapping over key/value pairs, filtering, and so on.
Unfortunately, there doesn’t appear to be any documentation but it’s easy to look at the source to see what functions are available. The DOC strings do a good job of explaining what each function does.
If you have code that uses two or more of the supported data types, you should consider the map
library. It provides a consistent set of functions that operate on them all. In particular, it makes it easy to change the data type of a variable because most of the code to manipulate it will be the same. As with the ht
and kv
libraries, the names of the functions and the ordering of the arguments are consistent and intuitive. That makes it easy to remember them.