From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: plist-put: destructive? Date: Mon, 23 Jan 2017 10:01:47 +0100 Message-ID: <20170123090147.GA19549@tuxteam.de> References: <87mvelzgrr.fsf@ericabrahamsen.net> <8737gcxt4e.fsf@ericabrahamsen.net> <87tw8rx6he.fsf@ericabrahamsen.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed X-Trace: blaine.gmane.org 1485162159 4914 195.159.176.226 (23 Jan 2017 09:02:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 23 Jan 2017 09:02:39 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 23 10:02:34 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cVaWD-0000ZF-R9 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2017 10:02:29 +0100 Original-Received: from localhost ([::1]:39817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVaWI-0008GE-VJ for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Jan 2017 04:02:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVaVm-0008Eo-5O for help-gnu-emacs@gnu.org; Mon, 23 Jan 2017 04:02:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVaVh-00052I-BO for help-gnu-emacs@gnu.org; Mon, 23 Jan 2017 04:02:02 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:42711 helo=tomasium.tuxteam.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cVaVh-00051U-62 for help-gnu-emacs@gnu.org; Mon, 23 Jan 2017 04:01:57 -0500 Original-Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1cVaVX-000576-Qs for help-gnu-emacs@gnu.org; Mon, 23 Jan 2017 10:01:47 +0100 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 5.199.139.25 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112148 Archived-At: -----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-----