Since Emacs 25.1, Artur Malabarba’s excellent let-alist macro has been a built-in feature of Emacs. As the name suggests, it’s a way of dealing with alists. The idea is that instead of writing a series of assq
and cdr
statements, you just write .tag
where tag
is the car
of an alist element. Malabarba’s post gives an example of its use.
There’s a nice example of its use by T. V. Raman in a post about parsing the result of a json-read. Most of the examples I’ve seen use json-read
to produce the alist, but the macro can, of course, be used with any alist. It can even handle nested alists as both Malabarba’s and Raman’s examples make clear.