From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: pcase ` meaning [Was: Re: Replace trivial pcase occurrences in the Emacs sources] Date: Sun, 28 Oct 2018 23:54:00 +0100 Message-ID: <87efc9isxj.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <87wprqitj5.fsf@fencepost.gnu.org> <56893C8C.3060200@yandex.ru> <87oad2irtd.fsf@fencepost.gnu.org> <5689456A.1010601@yandex.ru> <87egdy8tyz.fsf@fencepost.gnu.org> <56895FDE.4060406@yandex.ru> <8760za8r4a.fsf@fencepost.gnu.org> <87h9iunkcg.fsf@web.de> <87h8hc4xw2.fsf_-_@web.de> <83tvlcsnee.fsf@gnu.org> <87pnw037ar.fsf@web.de> <83ftwvs7y9.fsf@gnu.org> <877ei7mkfh.fsf@web.de> <87a7mze7tl.fsf@web.de> <87zhuykjjh.fsf@web.de> <871s8aesdc.fsf@portable.galex-713.eu> <87tvl6dc3e.fsf_-_@portable.galex-713.eu> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1540767174 29230 195.159.176.226 (28 Oct 2018 22:52:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2018 22:52:54 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Eli Zaretskii , Dmitry Gutov , Stefan Monnier , emacs-devel@gnu.org To: "Garreau\, Alexandre" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 28 23:52:50 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGtvL-0007S4-Pf for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2018 23:52:47 +0100 Original-Received: from localhost ([::1]:42457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGtxS-0006RU-5M for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2018 18:54:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGtws-0006RN-Bo for emacs-devel@gnu.org; Sun, 28 Oct 2018 18:54:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGtwo-00084e-RD for emacs-devel@gnu.org; Sun, 28 Oct 2018 18:54:22 -0400 Original-Received: from mout.web.de ([217.72.192.78]:60617) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gGtwo-00084O-A3; Sun, 28 Oct 2018 18:54:18 -0400 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MJCSM-1gIXZO2gMU-002pFd; Sun, 28 Oct 2018 23:54:04 +0100 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MJCSM-1gIXZO2gMU-002pFd; Sun, 28 Oct 2018 23:54:04 +0100 In-Reply-To: <87tvl6dc3e.fsf_-_@portable.galex-713.eu> (Alexandre Garreau's message of "Sun, 28 Oct 2018 03:44:21 +0100") X-Provags-ID: V03:K1:zELXRRtZ3gyEOuH160VsMmYovWQhXQ9WpRUp+ndbi1d7HdcA6RF L3P2XAjozdRddCq4AwUEBjWRSEAPK7JEmuVHq1/RNQkNWY0DERrBZjAXvjH0pBRzUqo7/p6 gP5zmF3KROYD97/0Hr2YTIXs8Yp45sICMKzE6OFpwylgNkjJb7tWTOgamC20EmaIK1J2Sky 52DXZqL8ne4wc5oygV+qQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:MbmEG/e3t0c=:J0tZlJT1j9jSiIxaZh9H44 0+DE4M0ACCtf+sFzb/iluOd4AQksKvSs/qXYrufw+1wgWUj5WlDWa2r7juxSG+DL5jyezr+av ww5+nqcYszl90M6Z5T7ATmZDvBndWni5LhDdKcBNuBdcyZHXJCj9i/MpXBMg3hRYEIMEaKMuu glsHQbvNWqxaz51oKbCKmAbXlSb4Y3gd/S66e5OeWoGnV6qWe8jrcTX6J3LV7qtwocIuE42PF 0WxlEWDNcJ8r+l0bIGW81HuAeWmukFrb143UtcSn/TQ9dys33r9SF9bi57yGhmIH9p++lpTCA 832V8G87Bk7vF5SMACDH3FrPYUOUYR45MPq3G/rRQ4yzuF5B1l/lZ4nL2GQGXpdXYxI6OxdhM lmOI2trN9o+2mGYyklx/Xr0jc47d7cTy8TOLtkqOZTXXrWaVGojTJ1FurEBtpA4K3VMG8BMsA mjj3yhDgROgO0P9RLiRUZff3FppO9XnB2SVxecAWlk7OMPUzNbZuN6628iPimsJzECN0sFvH+ /8JWCEafuO/vE9J+iEoOd9+4sF7lgLWSEhyB8v/fpzVk04WSvTAJLcxXdkUY3xdat7ZQh15Lt /z/Rjy8mrX/480iBxijWU83MrCHpzvft0G2fVsuT8Qn7sDcWRKoDekSxA3jUofaKFx1vgUZ4o QgekwKMKizZSl63YPDy1NtkEVKcxFzvP6VY0+SH5hPW3TfmBnCo+zWhAp/sIdlaJJYgSy/E50 0oBJ9bhsvE6LPOniB9Lis9afw7ZWfXVRIC3/5hV+HwqNFqQ2Wnn4CYlCCAI6HMVGFzVYpNWu X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.78 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:230758 Archived-At: "Garreau, Alexandre" writes: > So know I understand why advocating for replacing case with pcase: pcase > is not about pattern matching, it is just a correctly working case, > except it only works for atoms, with an optional prevailing > mini-language If you look at the definition of the ``' pcase macro you see that it is defined entirely in terms of the "things that only work for atoms" (it uses `app' on car and cdr). > Maybe that would make more sense if ` (and '?) were not part of pcase=E2= =80=99s > own mini-language, redefined by pcase, but if pcase actually truly > eval=E2=80=99d its pattern, defining pred, guard, etc. as real functions, > defined with a cl-letf, using lexical scoping so to prevailably define > all these + user-defined patterns. I think it would also be an interesting approach. You would additionally need some magical thing that binds variables for the scope of the current clause, however. That doesn't fit into that simple approach. But not less than into pcase itself. I wonder if it could be similarly efficient as pcase. > It even more feel wrong that, this, doesn=E2=80=99t work, for no reason Well, there is a reason: it is wrong ;-) > #+BEGIN_SRC emacs-lisp > (pcase [1 2] > ([a b] (+ a b))) > #+END_SRC That should be=20 #+begin_src emacs-lisp (pcase [1 2] (`[,a ,b] (+ a b))) #+end_src I'm sure you would have been able to find that after less than a minute when reading the pcase docstring. Michael.