From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Alfred M. Szmidt" Newsgroups: gmane.emacs.devel Subject: Re: Elisp threading macros Date: Thu, 29 Aug 2024 01:19:15 -0400 Message-ID: References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Garklein Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 29 07:19:55 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sjXZa-00043T-I9 for ged-emacs-devel@m.gmane-mx.org; Thu, 29 Aug 2024 07:19:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjXYz-0006Ze-EU; Thu, 29 Aug 2024 01:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjXYy-0006ZU-B3 for emacs-devel@gnu.org; Thu, 29 Aug 2024 01:19:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjXYy-0003x5-1f; Thu, 29 Aug 2024 01:19:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=r3RS3NiqEaeYAMNGHxZL9MkGlHg+qojyC9IEJFeN3GU=; b=LwkqvyIhRm3M KFvI79bgancG+H8OW5CBSwKJZOTgfNlK8TH1sUl11wIVHdLgAlCh4wLY5EhFtBRDnjdFTPrn9c43M yskhQGy6EJimCGJ1ALBAt9q/8Topafwqr0fZEwy2Ns6QzL7zCsSmAtvUXS4SHpkxaPAzeH0KUKtzX 9eKC9Pops2GKOQ/dTkHDogVDbUdzXwzg3sjM9ZcFq2okulDP6dYkINNuPpzKZuKCdMjBvCsy/qk7t eB4r+i/owzt+6OC00SiZNfmrmQne0bESCZ0lhC8QaWyccp+raHWmwJX/m+7WnMVbprYBO24Y+5VTE 4xRlsJ1LPWyiBnIl5jnnZg==; Original-Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1sjXYx-00087j-IV; Thu, 29 Aug 2024 01:19:15 -0400 In-Reply-To: (message from Garklein on Wed, 28 Aug 2024 10:08:05 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323171 Archived-At: `-some->' is useful in cases like this: (let (foo (function-which-may-return-nil)) (when foo (bar foo))) which can be rewritten, much cleaner, as (-some-> foo function-which-may-return-nil bar) Those two forms aren't the same. This is the macroexpand-all version: (let ((result (let ((result foo)) (if result (progn (function-which-may-return-nil result)))))) (if result (progn (bar result)))) Notice how e.g., function-which-may-return-nil actually gets the foo argument. And the semantics are also different. While the above might seam cleaner, since it is shorter, it is much harder to modify, maintain and reason about.