emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New assoc-let package


From: Ted Zlatanov
Subject: Re: New assoc-let package
Date: Thu, 04 Dec 2014 14:36:40 -0500
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (darwin)

On Wed, 3 Dec 2014 23:40:14 +0000 Artur Malabarba <address@hidden> wrote: 

AM> Simply put, the macro takes an alist and a body, and makes the data of
AM> the alist accessible by just writing the car of the desired cell
AM> preceded by a dot.
AM> For instance, the following:

AM>   (assoc-let alist
AM>     (if (and .title .body)
AM>         .body
AM>       .site))

AM> expands to

AM>   (let ((.title (cdr (assoc 'title alist)))
AM>         (.body (cdr (assoc 'body alist)))
AM>         (.site (cdr (assoc 'site alist))))
AM>     (if (and .title .body)
AM>         .body
AM>       .site))

I really, really like it.  Like a `destructuring-bind' for alists.

Should it maybe use `lexical-let'?

I hope it can go into the core so it's available by default.

Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]