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

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

Re: plist-put: destructive?


From: Eric Abrahamsen
Subject: Re: plist-put: destructive?
Date: Sun, 22 Jan 2017 19:31:09 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> 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))
>            ...)))

I wouldn't have thought of that, thanks! I need to get more familiar
with the lower-level list-manipulation stuff, I never think to reach for
them...




reply via email to

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