From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Sun, 19 Nov 2023 15:49:52 +0200 Message-ID: <763f067b-4ca9-1eba-9f3c-424c38589e9c@gutov.dev> References: <87fs169mjj.fsf@posteo.net> <093f11a1-57c2-5e56-d39b-26fef1c67cbb@gutov.dev> <25942.25061.217864.329049@retriever.mtv.corp.google.com> <87zfzdcz6z.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23545"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Cc: emacs-devel@gnu.org To: rms@gnu.org, Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 19 14:50:58 2023 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 1r4iCP-0005tM-8M for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Nov 2023 14:50:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4iBS-0001WU-WE; Sun, 19 Nov 2023 08:49:59 -0500 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 1r4iBR-0001WM-Th for emacs-devel@gnu.org; Sun, 19 Nov 2023 08:49:57 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r4iBQ-0003KD-5P; Sun, 19 Nov 2023 08:49:57 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 61FE35C0235; Sun, 19 Nov 2023 08:49:55 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Sun, 19 Nov 2023 08:49:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1700401795; x=1700488195; bh=seH/0jlN31aHDYdrvD2ALXkEG3ASiNG7KMa esk3e+mk=; b=W1UoIHUVeiGDl5yUNK1xivJ1Gn+wAXAYHiOTLu+MSCnyT28RvpI 6M0gI/lKR/I6Es4bAi8DzB/fSwqD7AEqvFYS727JHBYqyxJ3VwJwgC6rswJtHEM0 xCzdXEyOX16TPwR8DN9tlCVQi6xVd9yNlJwNH8LlwKgqUVrWhrdExCp4eebi4Dmy uYhE2O+Dl0lKwFAcWctC4W4uJdCcl9SOh7bU0iWyqkSZq+310SyBVqLGgaC3nqQk a6JBr5jtT1bbuEC9SAAwv3wHhZRBIxSFOt8GvviHrWH3X+oOcQnAGHH+3zCelYH/ YN73Zbt+uup4y2BE371Phlhb8aK6Xk5nVNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1700401795; x=1700488195; bh=seH/0jlN31aHDYdrvD2ALXkEG3ASiNG7KMa esk3e+mk=; b=VpcRmYUYM5VJ3LtqKMwQ+kFRibzRjdYVw9qyFIgB5WPkgrjmZHJ Z9HvQg3gjNmCYnI2I97yerCeWkgiURcRL0Mg1Av60Vi4k33uNLVYbBZcHPHNN0el UMG25KmCWdypap0Lt9S+lrVPKiWq/dHfh/i4P/95RFu1TiNHHdR4JILbcCJ7lHUY GOmY2PXlEcgKhwgtt7kjUQTJ96884DUxO/okuvRmu+hK7GY+1gxYdplfzLu8JFpn S2ju60BAqReMw0KsNVky9ZiaH+eEnnZOCFejhSHypXSbtRqowwdtfYJZZb0AQ0ZK W1oduQ7F0kd7x+pgjYKYu1U0qUKV7CjSI8A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeggedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 19 Nov 2023 08:49:54 -0500 (EST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=66.111.4.26; envelope-from=dmitry@gutov.dev; helo=out2-smtp.messagingengine.com X-Spam_score_int: -65 X-Spam_score: -6.6 X-Spam_bar: ------ X-Spam_report: (-6.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-3.74, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:312974 Archived-At: On 18/11/2023 05:04, Richard Stallman wrote: > > (`(,_ . ,(and (pred functionp) f)) (funcall f)) > > (`(,hookfun . (,start ,end ,collection . ,plist)) > > I read the Info documentation of pcase a few days ago and I can't > recall the rules for understanding those two pcase clauses. What I > recall is that they are not to be interpreted as Lisp expressions. > They contain code that looks like Lisp but does not have the same > semantic rules as Lisp. Yes: it's a domain-specific language. To interpret those backquotes and commas, one can imagine that the they do the inverse of the usual. If normally you have commas to insert the values from the environment (variables or expressions) into the backquoted form, then inside pcase they are used to do the opposite: to extract values from the expression at given positions, and bind them with given names in the corresponding clause's environment. I think that's pretty clever, but also quite readable once you "grok" the above idea.