emacs-devel
[Top][All Lists]
Advanced

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

Re: Code for cond*


From: Stefan Monnier
Subject: Re: Code for cond*
Date: Sun, 25 Feb 2024 10:03:48 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> If what you want is to ignore the last cdr of one specific list, it is
> hard to find anything simpler than `. ,_'.  But that approach becomes
> messy when you need to put it at the end of many lists in one pattern.
> One of the first pcase examples I saw needed to do that.
[...]
> So I added a way to change the default locally for whether to check
> the last cdr or not.

Hmm... that leaves more questions open:

- Which example was that?  Have you found many others?
- What do you reply to my own experience that we often want to accept
  not only longer lists but also shorter lists?
- It doesn't explain why you apply it recursively.
- As you say for "one specific list, it is hard to find anything simpler
  than `. ,_'", yet you added `cdr-safe` which applies to a single
  pattern, and thus typically to a single list, unless the pattern is
  a big (or ...) pattern which are rather unusual.

BTW, regarding "anything simpler than `. ,_'", there is ",@_".
Whether it's "simpler" is debatable, of course, but it is one
char shorter.  Pcase doesn't support it, but I've hesitated to add
support for it (the problem is that general support for ,@ in backquote
patterns is somewhere between hard and undesirable, so I'm not sure it's
worth adding support for it only in those cases where it can be
supported satisfactorily).


        Stefan




reply via email to

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