From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: John Mastro Newsgroups: gmane.emacs.devel Subject: Re: if-let and when-let: parallel or sequential Date: Mon, 11 Aug 2014 20:30:36 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1407814268 13067 80.91.229.3 (12 Aug 2014 03:31:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Aug 2014 03:31:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 12 05:31:02 2014 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 1XH2ne-0007oY-KA for ged-emacs-devel@m.gmane.org; Tue, 12 Aug 2014 05:31:02 +0200 Original-Received: from localhost ([::1]:38944 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH2ne-0007Ul-8T for ged-emacs-devel@m.gmane.org; Mon, 11 Aug 2014 23:31:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH2na-0007Ug-M2 for emacs-devel@gnu.org; Mon, 11 Aug 2014 23:30:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XH2nZ-0001mu-CD for emacs-devel@gnu.org; Mon, 11 Aug 2014 23:30:58 -0400 Original-Received: from mail-oa0-x22b.google.com ([2607:f8b0:4003:c02::22b]:50102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XH2nZ-0001lK-6y for emacs-devel@gnu.org; Mon, 11 Aug 2014 23:30:57 -0400 Original-Received: by mail-oa0-f43.google.com with SMTP id i7so6873741oag.2 for ; Mon, 11 Aug 2014 20:30:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=zYbgHLdPOlszZ/wyMDaocSm7HuxD2idlr8BAvaurszQ=; b=wyZ4nTmr8HkrjaKhVnTgllYFQAdAfS7TOjldmdPwFQzoiU1l9y8rZU8un9YDtNFhi/ M90DVoSxpxGFLmP69lcCibsYqaMmfls9siOYYW07G7Vwq5gFPVKyyVUCHJgBu1NWN0WW niqKUWGNAdHlOOq0Po3QmrQS9RvbA0z5+Ekqk67IDkQQUyinozzmX/OhlxbKrVrgEFh6 9jbglvemZnMqMgk6gu7QaXns67Kj83R7f48Y+HqWxKzHTC+EuWxP6yl7EWlk/NKvyXro JahH4TK+wQ35hCHpIoH6o9SE+6csUcvoo6ePM7byiRM9a/x8wh0HoAHiRdwmfM6Iggkp BEOg== X-Received: by 10.60.70.169 with SMTP id n9mr1799580oeu.62.1407814256194; Mon, 11 Aug 2014 20:30:56 -0700 (PDT) Original-Received: by 10.76.172.36 with HTTP; Mon, 11 Aug 2014 20:30:36 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::22b 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:173589 Archived-At: Richard Stallman wrote: > With several sequential bindings, the alternative is > > (let* ...bindings... > (if ...)) > > Thus, if-let saves just one level of nesting > even if there are several bindings. The current implementation in trunk is actually short-circuiting. So the equivalent to: (when-let ((a (foo)) (b (bar))) b) Would be: (let ((a (foo))) (when a (let ((b (bar))) b))) And so on. The only non-Clojure variant of these that I'm really familiar with is Alexandria's[1]. It has both `-let' and `-let*' versions, allows multiple bindings, and is not short circuiting. (I don't say this to suggest we should mimic them, just to expose "where I'm coming from"). Anyway, I agree with Bozhidar that they'll be nice to have regardless of the particulars, so I'll gracefully bow out :) [1] http://common-lisp.net/gitweb?p=projects/alexandria/alexandria.git;a=blob;f=binding.lisp -- john