From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Sweeter Emacs Lisp Date: Fri, 09 Aug 2013 22:52:02 -0400 Message-ID: References: <8738rh6ftk.fsf@gnu.org> <87a9lezh9w.fsf@zigzag.favinet> <8738r5zyap.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1376103141 14054 80.91.229.3 (10 Aug 2013 02:52:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 10 Aug 2013 02:52:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 10 04:52:22 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V7zHx-0007W4-Kq for ged-emacs-devel@m.gmane.org; Sat, 10 Aug 2013 04:52:21 +0200 Original-Received: from localhost ([::1]:41170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7zHw-0005r5-OM for ged-emacs-devel@m.gmane.org; Fri, 09 Aug 2013 22:52:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7zHn-0005q5-W0 for emacs-devel@gnu.org; Fri, 09 Aug 2013 22:52:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7zHg-0005Ct-HP for emacs-devel@gnu.org; Fri, 09 Aug 2013 22:52:11 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:40131) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7zHg-0005Cj-DG for emacs-devel@gnu.org; Fri, 09 Aug 2013 22:52:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EABK/CFFLd/Nq/2dsb2JhbABEvw4Xc4IfAQVWMws0EhQYDYhIwS2NYYMpA6R6gV6DEw X-IPAS-Result: Av0EABK/CFFLd/Nq/2dsb2JhbABEvw4Xc4IfAQVWMws0EhQYDYhIwS2NYYMpA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="21307274" Original-Received: from 75-119-243-106.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([75.119.243.106]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 09 Aug 2013 22:51:56 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 5F584AE0F1; Fri, 9 Aug 2013 22:52:02 -0400 (EDT) In-Reply-To: <8738r5zyap.fsf@zigzag.favinet> (Thien-Thi Nguyen's message of "Tue, 23 Jul 2013 06:37:50 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:162545 Archived-At: > (defmacro cool-cond (&rest clauses) > (let ((rev (reverse clauses)) > one elab) > (while (setq one (pop rev)) > (setq elab (pcase one > (`(let ,var ,exp) > `((t (let ((,var ,exp)) > (cond ,@elab))))) > (`(let ,var) > `((t (let (,var) > (cond ,@elab))))) > (_ (cons one elab))))) > `(cond ,@elab))) That sounds about right. Two remaining problems: - Easy one: improve the macro to reduce the nesting depth (consecutive `let's should be turned into a single let*, and consecutive non-lets should be together in a single `cond'). You can probably use macroexp-let* and macroexp-if for that. - Hard one: come up with a better name. Stefan