emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Instead of pcase


From: João Távora
Subject: Re: Instead of pcase
Date: Thu, 30 Nov 2023 20:47:22 +0000

On Thu, Nov 30, 2023 at 7:27 PM Eli Zaretskii <eliz@gnu.org> wrote:

> I think you are missing the point.  The point is that pcase has so
> many semi-magical syntax features that use punctuation characters in
> creative ways that every extra punctuation character presents a
> puzzle.  Faced with
>
>   (`(,hookfun . ,start ,end))
>
> one immediately asks himself why the period,
> where in "normal" Lisp expressions it would be completely
> redundant?

FWIW the period is pretty self-evident to me that it separates
a car from a cdr in given cell of a cons chain.

However, in your example this is an error, just as it is in
this "normal" expression if what you wanted was to construct
a list.

 `(,hookfun . ,start ,end)

So I think you probably meant

   `(,hookfun . (,start ,end))

And this is valid in both pcase and normal backquoted list
expressions.  Furthermore, here the period is _not_ redundant.

IMO what's relatively contrived in pcase-- but very well contrived
I should add -- is the use of the backtick and comma, whose
usual job is output and list construction, to do the reverse,
to express input and list destructure.

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]