[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Instead of pcase
From: |
Jim Porter |
Subject: |
Re: Instead of pcase |
Date: |
Mon, 20 Nov 2023 21:14:48 -0800 |
On 11/20/2023 6:42 PM, Richard Stallman wrote:
I uderstand that when you say it, but when I saw the line
> (`(,hookfun . (,start ,end ,collection . ,plist))
I was not sure which part of the line that rule applies to.
In particular, what is the reason for the period and inner
parenthsses? Why doesn't the code say this?
> (`(,hookfun ,start ,end ,collection . ,plist)
Would that be equiva;ent?
Yes, These are equivalent (unless I'm severely mistaken):
----------------------------------------
(pcase '(func 0 10 coll plist1 plist2)
(`(,hookfun . (,start ,end ,collection . ,plist))
(message "hookfun = %s start = %s end = %s collection = %s plist = %s"
hookfun start end collection plist)))
=> "hookfun = func start = 0 end = 10 collection = coll plist =
(plist1 plist2)"
(pcase '(func 0 10 coll plist1 plist2)
(`(,hookfun ,start ,end ,collection . ,plist)
(message "hookfun = %s start = %s end = %s collection = %s plist = %s"
hookfun start end collection plist)))
=> "hookfun = func start = 0 end = 10 collection = coll plist =
(plist1 plist2)"
----------------------------------------
I could not assume the inner parenthsses were unnecessary. Maybe
there was a conventiob by which they change the meaning.
I did not know.
I think this might be a case where the 'pcase' code was written in a
more-cryptic-than-necessary manner, which adds extra confusion. This
could be a good example to include in some documentation though: it can
show how one's intuition about "ordinary" backquoted forms can apply
directly to reading 'pcase'.
- Re: Instead of pcase, (continued)
- Re: Instead of pcase, Stefan Monnier, 2023/11/24
- Re: Instead of pcase, Barry Fishman, 2023/11/19
- Re: Instead of pcase, Dmitry Gutov, 2023/11/19
- Re: Instead of pcase, Michael Heerdegen, 2023/11/20
- Re: Instead of pcase, Richard Stallman, 2023/11/22
- Re: Instead of pcase, Dmitry Gutov, 2023/11/24
- Re: Instead of pcase, Michael Heerdegen, 2023/11/24
- Re: Instead of pcase, Dmitry Gutov, 2023/11/24
- Re: Instead of pcase, Dmitry Gutov, 2023/11/19
- Re: Instead of pcase, Richard Stallman, 2023/11/20
- Re: Instead of pcase,
Jim Porter <=
- Re: Instead of pcase, Yuri Khan, 2023/11/21
- Re: Instead of pcase, Dmitry Gutov, 2023/11/21
- Re: Instead of pcase, Michael Heerdegen, 2023/11/21
- Re: Instead of pcase, Richard Stallman, 2023/11/22
- Re: Instead of pcase, Richard Stallman, 2023/11/23
- Re: Instead of pcase, Jim Porter, 2023/11/23
- Re: Instead of pcase, Eli Zaretskii, 2023/11/24
- Re: Instead of pcase, Emanuel Berg, 2023/11/25
- Re: Instead of pcase, Dmitry Gutov, 2023/11/24
- Re: Instead of pcase, Lynn Winebarger, 2023/11/24