From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71503: 30.0.50; pcase-lambda (with "and" and "guard") does not work as expected Date: Sat, 06 Jul 2024 10:38:00 +0300 Message-ID: <86frsn55t3.fsf@gnu.org> References: <87r0d2lfjd.fsf@posteo.de> <87h6dvud8u.fsf@posteo.net> <86tthlidap.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14545"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mekeor@posteo.de, monnier@iro.umontreal.ca, 71503@debbugs.gnu.org To: philipk@posteo.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 06 09:39:10 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sQ00k-0003Zn-J8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jul 2024 09:39:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQ00a-0006zG-5L; Sat, 06 Jul 2024 03:39:00 -0400 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 1sQ00Z-0006ys-3c for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 03:38:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sQ00Y-0003GX-Rh for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 03:38:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sQ00c-0005Jb-9w for bug-gnu-emacs@gnu.org; Sat, 06 Jul 2024 03:39:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Jul 2024 07:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71503 X-GNU-PR-Package: emacs Original-Received: via spool by 71503-submit@debbugs.gnu.org id=B71503.172025149320355 (code B ref 71503); Sat, 06 Jul 2024 07:39:02 +0000 Original-Received: (at 71503) by debbugs.gnu.org; 6 Jul 2024 07:38:13 +0000 Original-Received: from localhost ([127.0.0.1]:45491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPzzp-0005IF-EO for submit@debbugs.gnu.org; Sat, 06 Jul 2024 03:38:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:43692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPzzn-0005Hx-9J for 71503@debbugs.gnu.org; Sat, 06 Jul 2024 03:38:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPzze-00038F-2C; Sat, 06 Jul 2024 03:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=AkFgevUKqLqlTOiWh5zqfE4tMaK+YvkaP3Ot4xwhuqI=; b=Nl7xZz8ivsuW EzmsWFD6NhUPLfRrp+qZmoWFsXz4eIOGGUCsibSj8gNOlKmJEIzXqRiWWPBod5L1XQ+M/bdsGW21l y4qJvI34G7YXODILLv+jLOTRMdY9UDJ6jjVXFd+ljhu//Y1f2+RnzDLJkXQuPEmMg2zeodfNX1nQ7 qpK3/5dP6d21r3TqAnIl7m9UDDTBQ1gzXr4IlwRF4530UHyF8hh2mh3PmAqmU+EX68KdxfXgBy5FV iZMKqTb63/6PMTeeg3G5UxJQAwdt4vQ4bMcNLRgupw5msRAFqqArsJGJDZRDIvNGegbiJ9WncITQC fu6huPQKv+GLmgapMLv1ZA==; In-Reply-To: <86tthlidap.fsf@gnu.org> (message from Eli Zaretskii on Sat, 22 Jun 2024 11:37:02 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288465 Archived-At: Ping! > Cc: mekeor@posteo.de, 71503@debbugs.gnu.org > Date: Sat, 22 Jun 2024 11:37:02 +0300 > From: Eli Zaretskii > > > Cc: 71503@debbugs.gnu.org > > From: Philip Kaludercic > > Date: Fri, 14 Jun 2024 08:42:25 +0000 > > > > Mekeor Melire writes: > > > > > I was expecting these two expressions to evaluate to the same value. > > > First, we call `pcase' on a value with a pattern involving `and' and > > > `guard': > > > > > > (pcase "value" > > > ((and v (guard (string= "not-value" v))) v)) > > > ;; => nil > > > > > > Second, let's use the same value and pattern, but this time using > > > `pcase-lambda': > > > > > > (funcall > > > (pcase-lambda > > > ((and v (guard (string= "not-value" v)))) v) > > > "value") > > > ;; => "value" > > > > > > Am I missing something or is this a bug? > > > > The difference is that pcase-lambda doesn't do case-distinction, but > > just pattern matching/destruncting. So if the pattern-matching fails, > > then the variable is just not bound, instead of the entire expression > > falling back to returning no value/nil. I am guessing you wanted to > > have something like Scheme's `case-lambda'[0]? Or we could clarify this > > point in the docstring. > > Would you mind suggesting a clarification for the doc string (and the > ELisp manual as well)? > > Thanks. > > > >