GNU bug report logs - #49809
[PATCH] Add macro 'pcase-setq'

Previous Next

Package: emacs;

Reported by: Okam <okamsn <at> protonmail.com>

Date: Sun, 1 Aug 2021 17:21:01 UTC

Severity: normal

Tags: patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: okamsn <at> protonmail.com, 49809 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: bug#49809: [PATCH] Add macro 'pcase-setq'
Date: Fri, 13 Aug 2021 04:55:39 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> >   (pcase-setq (or `((,a) [(,b)])
> >                   x)
> >               '((1) [(2)]))
> >   (list a b x)) ;; ==> (1 2 nil)
>
> If you want to do different things depending on which pattern matches
> you should use `pcase` rather than `pcase-setq` (or `pcase-let` for
> that matter).

Is using a pattern like

   (or `[,a ,b] `[,a ,b ,_])

ok?


Michael.




This bug report was last modified 3 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.