From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: combining cond and let, to replace pcase. Date: Tue, 21 Nov 2023 16:53:37 +0100 Message-ID: <874jhfayri.fsf@web.de> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34765"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 21 16:54:23 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 1r5T4x-0008vt-5Q for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Nov 2023 16:54:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5T48-0002eF-Jg; Tue, 21 Nov 2023 10:53:32 -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 1r5T46-0002dl-3s for emacs-devel@gnu.org; Tue, 21 Nov 2023 10:53:30 -0500 Original-Received: from mout.web.de ([212.227.15.14]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r5T44-0001rz-Bt; Tue, 21 Nov 2023 10:53:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1700582003; x=1701186803; i=michael_heerdegen@web.de; bh=/Q3b+NBDZzl5Ypa0cA9NpjxcqLLFlhsJVfrm9634uxQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=OOs3obAiACgBwbhGe9EXSOKf0I34/0s20flJg9wnF72sqkBt28N5rELljw7toQvc 8GofGVio1AUn/X4muWamnQHbpynBUfLeGLRvt4fnV6iTVHE5e3lXGZMwZWMuStD6Q ORC9PC8bV7CCLX6MO7ILdqmY79QSdWXPGwUYxh2Yzv4Bf0RafyHtncPeLZC3JYKzV SNilqXMcWMFIPTjV4nDTf07BoM0/FXJZOZffTw499PM/1rPurySspeU4iq9EPElrs tVsZ1ifBRp2h7yRzEmaRcfHXmDe+bdBE0YEeBDR+WzCxyiSCIad2lETtZfJ2l4Hof sdr0w/X4OQMw8rKsPQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Original-Received: from drachen.dragon ([178.6.28.177]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MlsKF-1roBbF3RDf-00iozt; Tue, 21 Nov 2023 16:53:22 +0100 In-Reply-To: (Richard Stallman's message of "Fri, 17 Nov 2023 22:03:56 -0500") X-Provags-ID: V03:K1:Ah2U0bouZ48HA/UzbjlWSdRdMO00Bm3ss5MSiO9/GXhOUAD1N5f cLHucSV7ZE2JPpc2mYad97J3vcD/oLrfnNMiYgmVF9w7XJisVVZObYzavx/HkPbNcA2I3sX BhRPXSKAi4PwkAHaAGg0fNN93KtEt42x68azWCPCVyRghqH5EgCh8VHm4lxTTcE4DA6Kmrr 7SaGlNi+8tYN8Xj0HeGRg== UI-OutboundReport: notjunk:1;M01:P0:VhHgldBAQnY=;pCYeX+nPDYXhCPehUxUCcGG/r/p 8gC/O2xsavNFFJ1eWEEi3CIZY9Wly1RoKtJJbsaFpe4QbgezS345C5MC4tyEPmFHk1mBcAAlR C+MuuVBmJWChLbvbLWfwZVdBp8qkb9gb3Q3rZHYBxQCTWcA1YS1oQE0EM+ZLLz7Cg2Dx6noSv fvNcw1HwxrmRy9zjSTyk7NapHEjQdBrF+77Etm46u9RlKWvL8qkCCfX57UZedHDeqKS2r+ACJ aJuPmB3wO15joQdlz3QaiCP7D0cATJ1SHBik/r6kC6oTNfwmnWmmQpNoAhSwTeBRFpoWACJD2 GTzlCC2KG5XNzN5EeCKaSCtEIv65SKgWSh5bUOb6BwsoqrtiZKUXD/rUXmvY33Y01/IiJzZIZ jEs4w87ijQEXT0ICvC4yXoM9m3ETCsOo1u/n7pkMo+/F+Kl3HJj2k4rpFrPgROL0t0ixBYSba KS41tmy+lg3wPfWKuYaO4vjG9+FGHdeag0bJ9Pvez5Zx3I8j1smN5GWI/FN8TShnT216V2g+e MiSKf6ZAKkZ91GjOJat22MyDYXkcmAT2wg/akrKE3nQNUuLrUuNLz0puxNrjVvJVcl3OKfW25 a9nJA7EFM0acnjmj+eupXXIukgucABywT+VzidlF2owV720WAoVAR2ELxLJ9+iJnr5svNwGzZ ymjzAAOGoU+kNvRea10Ra2ZYxIW7VGqbhYtd7RBtLduXR3Lp+JLpZunC+SxVkjtxH4RFtqKu5 C5Xcvgbw9/fbDHy562iW8cJMrW0zpAQLpa/BZ9dyTwQM2+1W0fQOTjdtZQC81ytG/APfB8wM Received-SPF: pass client-ip=212.227.15.14; envelope-from=michael_heerdegen@web.de; helo=mout.web.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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:313114 Archived-At: Richard Stallman writes: > Here's an example to show what I have come up with along these lines: > > (cond* (:bind (x foobar) y z (foo 5) a) ;; variables to bind, as in let > ;; I'm also thinking of using nil instead of :bind. > > ;; t as condition means run this clause unconditionally > ;; then continue with next clause. > (t do-this-unconditionally-and-dont-stop...) > > ;; Tests with a new function `match' which I'm going to work on next. > ((match x 'foo) ...) > > ;; t in the last clause means the same as in previous clauses, > ;; but you can think of it as being the same as in `cond'. > (t do-this-as-last-resort) > ) > > Rhe idea is that conf* does part of pcase's added functionality, and > `match' will do the rest. But it is not necessary to cram _all_ the > additional matching functionality (to compare to pcase) into a single > new function. We could have more than one new function, eacn for its > own kind of pattern matching. I've also sometimes missed a cond-let. I think the above example shows something slightly different: binding is done in one branch, but the bindings are visible in all (following?) branches (instead of only the branch BODY). So that's, at least in this example, more or less an amalgamated let + cond. The interesting part, the matching, is not shown, so I only have a vague imagination of the whole picture. Have you continued working on this approach in the meantime? Michael.