From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Pattern matching on match-string groups #elisp #question Date: Thu, 25 Feb 2021 19:28:16 +0100 Message-ID: <80CE2366-76F4-4548-B956-F16DFCE23E4C@acm.org> References: <87v9agxkld.fsf@tcd.ie> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7112"; mail-complaints-to="usenet@ciao.gmane.io" Cc: "Basil L. Contovounesios" , Ag Ibragimov , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 25 19:29:24 2021 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 1lFLO7-0001gw-8Q for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Feb 2021 19:29:23 +0100 Original-Received: from localhost ([::1]:59178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lFLO6-0003lh-Ai for ged-emacs-devel@m.gmane-mx.org; Thu, 25 Feb 2021 13:29:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFLNI-0003K1-I0 for emacs-devel@gnu.org; Thu, 25 Feb 2021 13:28:37 -0500 Original-Received: from mail211c50.megamailservers.eu ([91.136.10.221]:50334 helo=mail194c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lFLNE-0003vF-7C for emacs-devel@gnu.org; Thu, 25 Feb 2021 13:28:30 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1614277699; bh=8yXbcDLjfzAS4LOVo0uHOdZj4NmM258Zs9hSgeKL32Y=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=HiaiHOQWjquuSQe+F/sUkr6dBFG24Xl0LKPiFZSswl+jXM/Bm2bzZ3VrViF4y+5hk 4yAOE4ruWwO1CTz/jUyUp8alnHohQZnY2I8VktU+veI2hF4lRq/D82jlnuJWUtas2V /Tt8Z7Ot5W5+7eC1Y2Pf7rgGXHO1PcwY9ALI7/rY= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 11PISHAH025779; Thu, 25 Feb 2021 18:28:18 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A742F1E.6037EC43.004C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=Raru9Glv c=1 sm=1 tr=0 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=iRZporoAAAAA:8 a=GSHhr81h56y8UVZcZWIA:9 a=CjuIK1q_8ugA:10 a=NOBgFS-JBQ2l-kSd6-zu:22 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.221; envelope-from=mattiase@acm.org; helo=mail194c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:265637 Archived-At: 25 feb. 2021 kl. 16.32 skrev Stefan Monnier : >> The same won't work with pcase-let, so it's either unsupported or a = bug. >=20 > I'd say it's a bug. The patch below would fix it. Mattias, WDYT? Thank you, it looks like multiple bugs. The lack of (pred stringp) was = of course an oversight but unrelated to pcase-let, right? > (let* ((rx--pcase-vars nil) > (regexp (rx--to-expr (rx--pcase-transform (cons 'seq = regexps))))) > - `(and (pred (string-match ,regexp)) > + `(and (pred stringp) > + (app (lambda (s) (string-match ,regexp s)) (pred identity)) It does seem to work, but why exactly do we need this monstrosity = instead of (pred (string-match ,regexp))? Is it because pcase-let throws = away all `pred` clauses somewhere? It makes sense to do so but I haven't = found exactly where this takes place in pcase.el yet... Perhaps the assumption that non-binding clauses like `pred` (and what = else, `guard`?) are all side-effect free and can be thrown away in = pcase-let[*] should be documented? Not that I would have read it, of = course... I'll push a fix as soon as I understand the machinery a bit better, but = right now I'm wary of getting my fingers snapped off by the gears and = knives.