* bug#13678: 24.2.93; pcase: mention list-like QPatterns in the doc
@ 2013-02-10 17:49 Michael Heerdegen
2013-02-11 1:43 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2013-02-10 17:49 UTC (permalink / raw)
To: 13678
Hi,
due to the doc of `pcase' (similarly in the manual), this is the list of
forms that is valid as a QPattern:
,----------------------------------------------------------------------
| QPatterns can take the following forms:
| (QPAT1 . QPAT2) matches if QPAT1 matches the car and QPAT2 the cdr.
| ,UPAT matches if the UPattern UPAT matches.
| STRING matches if the object is `equal' to STRING.
| ATOM matches if the object is `eq' to ATOM.
`----------------------------------------------------------------------
I think it should also mention list-like patterns (without dot):
(QPat1 ...QPatn) matches any n-element list were each
element matches the according QPattern
Sure, `(QPAT1 . QPAT2)' also matches lists - but `(QPAT1 . QPAT2)' and
`(QPat1 ...QPatn)' are different forms (expressions) (although those
expressions could match equal values), so IMHO both should be mentioned.
Thanks,
Michael.
In GNU Emacs 24.2.93.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
of 2013-02-09 on drachen
Bzr revision: cyd@gnu.org-20130209044342-t2b063zu2fqy8nud
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description: Debian GNU/Linux 7.0 (wheezy)
Configured using:
`configure '--prefix=/usr/local/built/''
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#13678: 24.2.93; pcase: mention list-like QPatterns in the doc
2013-02-10 17:49 bug#13678: 24.2.93; pcase: mention list-like QPatterns in the doc Michael Heerdegen
@ 2013-02-11 1:43 ` Stefan Monnier
2013-02-11 13:37 ` Michael Heerdegen
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-02-11 1:43 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: 13678
> Sure, `(QPAT1 . QPAT2)' also matches lists - but `(QPAT1 . QPAT2)' and
> `(QPat1 ...QPatn)' are different forms (expressions)
Actually, no, they are identical:
(QPAT1 QPAT2 QPAT3) is indistinguishable from
(QPAT1 . (QPAT2 . (QPAT3 . nil)))
the equivalence between the two is imposed by the reader, long before we
know that these things will be "patterns in a pcase" rather than
expressions, or data in a quoted thingy, ...
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#13678: 24.2.93; pcase: mention list-like QPatterns in the doc
2013-02-11 1:43 ` Stefan Monnier
@ 2013-02-11 13:37 ` Michael Heerdegen
0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2013-02-11 13:37 UTC (permalink / raw)
To: 13678
Hi Stefan,
> > Sure, `(QPAT1 . QPAT2)' also matches lists - but `(QPAT1 . QPAT2)' and
> > `(QPat1 ...QPatn)' are different forms (expressions)
>
> Actually, no, they are identical:
>
> (QPAT1 QPAT2 QPAT3) is indistinguishable from
> (QPAT1 . (QPAT2 . (QPAT3 . nil)))
>
> the equivalence between the two is imposed by the reader, long before we
> know that these things will be "patterns in a pcase" rather than
> expressions, or data in a quoted thingy, ...
Simply right, thanks. I wonder, however, if that's clear for every
user. Nonetheless, there are enough examples in
(elisp) Pattern matching case statement
that use the (QPAT1 QPAT2 QPAT3) syntax. So, I'll close this, thanks.
Regards,
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-11 13:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-10 17:49 bug#13678: 24.2.93; pcase: mention list-like QPatterns in the doc Michael Heerdegen
2013-02-11 1:43 ` Stefan Monnier
2013-02-11 13:37 ` Michael Heerdegen
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).