help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: plist-put: destructive?


From: tomas
Subject: Re: plist-put: destructive?
Date: Mon, 23 Jan 2017 10:01:47 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Jan 22, 2017 at 12:30:49PM -0500, Stefan Monnier wrote:
> > The code I'm working has many repeated clauses looking like:
> >
> > (when thing1
> >   (setq the-plist (plist-put the-plist :thing thing1)))
> 
> FWIW, I've found that such code can often advantageously be turned
> into a non-side-effecting form like:
> 
>    (let ((the-plist
>           (nconc
>            (when thing1 (list :key1 thing1))
>            (when thing2 (list :key2 thing2))
>            ...)))

Thanks for this one! I positively know I've been struggling for
something like that, only to come up with a far clumsier variant.

- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAliFxnsACgkQBcgs9XrR2kY82wCfboH2ToyZGcsOaoFCB1zuqxQ/
5hoAn3gM7xvUAvQfZSr7CH9+wCeDxRDn
=hZBt
-----END PGP SIGNATURE-----



reply via email to

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