From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.devel Subject: Re: pcase pattern syntax (was: Replace trivial pcase occurrences in the Emacs sources) Date: Fri, 26 Oct 2018 09:16:29 +0200 Message-ID: <20181026071629.GA19652@Swift> References: <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> <20181024083423.GA13100@Swift> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: blaine.gmane.org 1540538443 18135 195.159.176.226 (26 Oct 2018 07:20:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 26 Oct 2018 07:20:43 +0000 (UTC) User-Agent: Mutt/1.9.4 (2018-02-28) To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 26 09:20:39 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 1gFwQ9-0004Zn-PC for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2018 09:20:38 +0200 Original-Received: from localhost ([::1]:58620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFwSG-0007Wf-7J for ged-emacs-devel@m.gmane.org; Fri, 26 Oct 2018 03:22:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFwS0-00079o-4w for emacs-devel@gnu.org; Fri, 26 Oct 2018 03:22:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFwRl-0006iq-So for emacs-devel@gnu.org; Fri, 26 Oct 2018 03:22:25 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:57119) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gFwRl-0006dK-DA for emacs-devel@gnu.org; Fri, 26 Oct 2018 03:22:17 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id E206021FED for ; Fri, 26 Oct 2018 03:22:15 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 26 Oct 2018 03:22:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= resent-from:resent-date:resent-message-id:resent-to:date:from:to :subject:message-id:references:mime-version:content-type :in-reply-to; s=fm1; bh=apPycCCAmi73deEpm0YOo00wAmy9lM63qZbR0Ku4 /dc=; b=fSpCjw5awyAf6m35VIkxMDsF1LN+sdriyEqeImSnYQCOjCYxg+AgQumW g1Wkc8O+mi7L8vjdtXa1p5ie9Y/Chb3RrR/YkkQgG4pNZDziJjGgA7OxjwEkCyS+ rx3vHw4/b4xUJ49EkKfQheKk9qLKpGxRmRWFOnRRFxFK4WX0r1d1iaF3BfdLgz+F wHT7kqFLeYrDLY+u/vx9Kji2NZbvmgbu7dS/J8d1r1HSYuhGcaEgLMKArK6YuwoA zibGLWcI1zdU8tMD8YnQGMHPLjeBD+y1V4mlesuMiL0f2zZ/OR3axFMYIT+cP3fp IRvUix7U2u+h5jjfHzyJ8woAMwLMjw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:resent-date:resent-from :resent-message-id:resent-to:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=apPycCCAmi73deEpm 0YOo00wAmy9lM63qZbR0Ku4/dc=; b=QwVJOTj3R0yiF9YW/ZxwYHUyig4Kv5AOW OwjwzNnnPGk+G46eIBjdACay3m/IZWGfBDNoYWEWU89ePVxSaUa3sID+a2FXlyBz VL0kNyyTps9VPbZfu7fsLWhHO4oYO4BsSUbCnQyuFy4HQ0xZ5p4NMQndZ2afhEmr NzhEMV0t1+2X9+JLt2SQ659EZeYEinL1lUBPgcyv8N+CdfJOsQO8qZnBr5wS3mOW I4tdN1TkRiyjxRM7IZTj0JzymdkqgILcCBkkpjh7IZ8dAo/GStvchxQvOQxjcBFD txNrtCg1JTrVfKtsKsOgh1o2MKx2PkFKoq4dbp4wMuLfeyLXKuj2g== X-ME-Sender: X-ME-Proxy: Original-Received: from Swift (freund-druck.geistwis.uni-wuppertal.de [132.195.204.212]) by mail.messagingengine.com (Postfix) with ESMTPA id 2856FE4893 for ; Fri, 26 Oct 2018 03:22:15 -0400 (EDT) Resent-From: Joost Kremers Resent-Date: Fri, 26 Oct 2018 09:22:13 +0200 Resent-Message-ID: <20181026072213.GB19652@Swift> Resent-To: emacs-devel@gnu.org Content-Disposition: inline In-Reply-To: X-Editor: Emacs of course! X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 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:230686 Archived-At: On Wed, Oct 24, 2018 at 09:03:51AM -0400, Stefan Monnier wrote: > > (pcase value > > (`(,_ 1 2) > > (message "Matched a list of anything followed by (1 2)"))) > > > > It is not clear to me why I couldn't simply write: > > > > (pcase value > > ((_ 1 2) > > (message "Matched a list of anything followed by (1 2)"))) > > The reason is simple: because pcase uses a more verbose pattern syntax. Perhaps I should have said "not immediately clear". I've snipped the rest of your reply, not because it's not interesting (it is) but because I'm really not qualified to argue better pattern matching syntax with you. I was just trying to answer Richard's question, who was wondering why people don't seem to use/like pcase as much as one might expect. And since I had tried a few times in the past to grok pcase but never really got it, I thought it might be helpful to offer my perspective. I'm sure that with some practice I could "get" pcase, it's not *that* difficult. I just find it noticeably more difficult to grok than other Elisp constructs that are new to me. Usually, it's enough to read the manual to get a basic idea of how and when to use something. Not so with pcase. -- Joost Kremers Life has its moments