let-alist
- Description
- Easily let-bind values of an assoc-list by their names
- Latest
- let-alist-1.0.6.tar (.sig), 2024-Mar-31, 10.0 KiB
- Maintainer
- Artur Malabarba <[email protected]>
- Atom feed
- let-alist.xml
- Website
- https://elpa.gnu.org/packages/let-alist.html
- Browse repository
- CGit or Gitweb
- Badge
To install this package from Emacs, use list-packages
.
Full description
This package offers a single macro, `let-alist'. This macro takes a first argument (whose value must be an alist) and a body. The macro expands to a let form containing body, where each dotted symbol inside body is let-bound to their cdrs in the alist. Dotted symbol is any symbol starting with a `.'. Only those present in the body are let-bound and this search is done at compile time. For instance, the following code (let-alist alist (if (and .title .body) .body .site .site.contents)) essentially expands to (let ((.title (cdr (assq 'title alist))) (.body (cdr (assq 'body alist))) (.site (cdr (assq 'site alist))) (.site.contents (cdr (assq 'contents (cdr (assq 'site alist)))))) (if (and .title .body) .body .site .site.contents)) If you nest `let-alist' invocations, the inner one can't access the variables of the outer one. You can, however, access alists inside the original alist by using dots inside the symbol, as displayed in the example above by the `.site.contents'.
Old versions
let-alist-1.0.5.el.lz | 2017-Feb-01 | 2.17 KiB |
let-alist-1.0.4.el.lz | 2015-Jun-12 | 1.96 KiB |
let-alist-1.0.3.el.lz | 2014-Dec-23 | 1.92 KiB |
let-alist-1.0.2.el.lz | 2014-Dec-21 | 1.89 KiB |
let-alist-1.0.1.el.lz | 2014-Dec-15 | 1.52 KiB |
let-alist-1.0.el.lz | 2014-Dec-11 | 1.48 KiB |