unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: philipk@posteo.net, mekeor@posteo.de
Cc: monnier@iro.umontreal.ca, 71503@debbugs.gnu.org
Subject: bug#71503: 30.0.50; pcase-lambda (with "and" and "guard") does not work as expected
Date: Sat, 20 Jul 2024 12:42:43 +0300	[thread overview]
Message-ID: <865xt0e6wc.fsf@gnu.org> (raw)
In-Reply-To: <86frsn55t3.fsf@gnu.org> (message from Eli Zaretskii on Sat, 06 Jul 2024 10:38:00 +0300)

Ping! Ping!

> Cc: mekeor@posteo.de, monnier@iro.umontreal.ca, 71503@debbugs.gnu.org
> Date: Sat, 06 Jul 2024 10:38:00 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Ping!
> 
> > Cc: mekeor@posteo.de, 71503@debbugs.gnu.org
> > Date: Sat, 22 Jun 2024 11:37:02 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > > Cc: 71503@debbugs.gnu.org
> > > From: Philip Kaludercic <philipk@posteo.net>
> > > Date: Fri, 14 Jun 2024 08:42:25 +0000
> > > 
> > > Mekeor Melire <mekeor@posteo.de> 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.
> > 
> > 
> > 
> > 
> 
> 
> 
> 





  reply	other threads:[~2024-07-20  9:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12  8:40 bug#71503: 30.0.50; pcase-lambda (with "and" and "guard") does not work as expected Mekeor Melire
2024-06-14  8:42 ` Philip Kaludercic
2024-06-14 16:08   ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22  8:37   ` Eli Zaretskii
2024-07-06  7:38     ` Eli Zaretskii
2024-07-20  9:42       ` Eli Zaretskii [this message]
2024-07-20 10:29         ` Philip Kaludercic
2024-07-20 10:46           ` Eli Zaretskii
2024-07-21 11:17             ` Philip Kaludercic
2024-07-21 13:33               ` Mekeor Melire
2024-07-20 14:06           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-21 12:39             ` Philip Kaludercic
2024-07-21 13:51               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-04  7:58                 ` Eli Zaretskii
2024-08-04 14:54                   ` Philip Kaludercic
2024-08-04 15:08                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865xt0e6wc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71503@debbugs.gnu.org \
    --cc=mekeor@posteo.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).