From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Harald Hanche-Olsen Newsgroups: gmane.emacs.devel Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...))) Date: Tue, 04 Jan 2011 18:56:13 +0100 (CET) Message-ID: <20110104.185613.410987030419274328.hanche@math.ntnu.no> References: <877hengesr.fsf@ambire.localdomain> <20110102.235234.923991058990597855.hanche@math.ntnu.no> <877hekbp0d.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1294163796 23031 80.91.229.12 (4 Jan 2011 17:56:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 4 Jan 2011 17:56:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 04 18:56:32 2011 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.69) (envelope-from ) id 1PaB7X-0006Vn-OY for ged-emacs-devel@m.gmane.org; Tue, 04 Jan 2011 18:56:31 +0100 Original-Received: from localhost ([127.0.0.1]:51699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaB7X-0007y1-AH for ged-emacs-devel@m.gmane.org; Tue, 04 Jan 2011 12:56:31 -0500 Original-Received: from [140.186.70.92] (port=40394 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaB7R-0007wh-5u for emacs-devel@gnu.org; Tue, 04 Jan 2011 12:56:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaB7P-0004F1-BV for emacs-devel@gnu.org; Tue, 04 Jan 2011 12:56:24 -0500 Original-Received: from anne.math.ntnu.no ([129.241.15.150]:63128) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1PaB7P-0004Ef-0d for emacs-devel@gnu.org; Tue, 04 Jan 2011 12:56:23 -0500 Original-Received: (qmail 9881 invoked from network); 4 Jan 2011 17:56:19 -0000 Original-Received: from gauss.math.ntnu.no (HELO localhost) (hanche@129.241.15.102) by anne.math.ntnu.no with ESMTPA; 4 Jan 2011 17:56:19 -0000 In-Reply-To: <877hekbp0d.fsf@ambire.localdomain> X-URL: http://www.math.ntnu.no/~hanche/ X-Mailer: Mew version 6.3.50 on Emacs 24.0.50 / Mule 6.0 (HANACHIRUSATO) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:134262 Archived-At: [Thien-Thi Nguyen (2011-01-04 16:41:06 UTC)] > () Harald Hanche-Olsen > () Sun, 02 Jan 2011 23:52:34 +0100 (CET) > > If you think you need this, I suspect the need can > just as easily be covered using a macro: > > (defmacro acond (&rest clauses) ...) > > They can be very handy. > > True. For my own code, i would not hesitate to use it. > However, this macro masks ‘it’ from an outer scope, so is > not a good general (for installation into Emacs) solution. I offered the solution firstly to argue that the new syntax may not be needed, since it is easily emulated. But if you want something to add to emacs for general use, it is easy enough to tweak my macro so it names the bound variable explicitly: (defmacro acond (var &rest clauses) "Binds variable VAR and processes CLAUSES just like `cond', except that VAR is set to the condition of the successful clause when the corresponding body is executed." `(let (,var) (cond ,@(mapcar (lambda (clause) `((setq ,var ,(car clause)) ,@(cdr clause))) clauses)))) - Harald