emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-25 2460cfa: * doc/lispref/lists.texi (Association Lists): Docu


From: John Wiegley
Subject: Re: emacs-25 2460cfa: * doc/lispref/lists.texi (Association Lists): Document 'alist-get'.
Date: Tue, 19 Jan 2016 10:42:57 -0800
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/24.5 (darwin)

>>>>> Eli Zaretskii <address@hidden> writes:

> Isn't 'cdr' also in that class? As well as at least a few others?

We have setcdr.

> AFAIU, this function just saves you from the need to repeatedly test the
> value returned by assq before using it, that's all.

The old way:

    GET: (cdr (assq key my-alist))
    SET: (setcdr (assq key my-alist) new-value)

The new hotness:

    GET: (alist-get key my-alist)
    SET: (setf (alist-get key my-alist) new-value)

So... not actually a whole lot of difference. I'm not sure if this is exciting
enough to need advertisement in a docstring. But in the elisp manual, sure.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



reply via email to

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