From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Pittman Newsgroups: gmane.emacs.devel Subject: Contributing (setf (assoc ...)) Date: Sat, 09 May 2009 23:55:46 +1000 Organization: I know I put it down here, somewhere. Message-ID: <87my9m4bz1.fsf@rimspace.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241877704 26188 80.91.229.12 (9 May 2009 14:01:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 9 May 2009 14:01:44 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 09 16:01:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M2n7N-0005Sv-No for ged-emacs-devel@m.gmane.org; Sat, 09 May 2009 16:01:34 +0200 Original-Received: from localhost ([127.0.0.1]:45423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2n7N-0002nS-9S for ged-emacs-devel@m.gmane.org; Sat, 09 May 2009 10:01:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M2n78-0002j3-8j for emacs-devel@gnu.org; Sat, 09 May 2009 10:01:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M2n72-0002hH-PG for emacs-devel@gnu.org; Sat, 09 May 2009 10:01:17 -0400 Original-Received: from [199.232.76.173] (port=33712 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M2n72-0002h4-Jn for emacs-devel@gnu.org; Sat, 09 May 2009 10:01:12 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:38671 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M2n72-0007ST-4B for emacs-devel@gnu.org; Sat, 09 May 2009 10:01:12 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1M2n6x-0005Ub-DT for emacs-devel@gnu.org; Sat, 09 May 2009 14:01:07 +0000 Original-Received: from ppp59-167-189-244.static.internode.on.net ([59.167.189.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 May 2009 14:01:07 +0000 Original-Received: from daniel by ppp59-167-189-244.static.internode.on.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 09 May 2009 14:01:07 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 24 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp59-167-189-244.static.internode.on.net User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:cf0sX3vBLPbdTlrC67blfEKqr0w= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:110796 Archived-At: G'day. I recently wanted to update as associative list, but apparently Emacs doesn't presently have an implementation of (setf (assoc ...)), at least in the snapshot I use. I believe I have paperwork on file already with the FSF for Emacs, even assuming that this is large enough to require such paperwork: (defsetf assoc (key place) (value) (let ((s1 (gensym))) `(let ((,s1 (assoc ,key ,place))) (if ,s1 (setf (second ,s1) ,value) (push (list ,key ,value) ,place))))) That implementation should work fine in all circumstances, I believe, and passes my local testing. Um, generally speaking there doesn't seem to be anything like a test suite for Emacs Lisp code that I could locate. Did I miss something, or is it generally the practice to just get it right? ;) Regards, Daniel