emacs-devel
[Top][All Lists]
Advanced

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

Re: pcase bindings in patterns with complicated logic


From: Ihor Radchenko
Subject: Re: pcase bindings in patterns with complicated logic
Date: Tue, 16 Jan 2024 13:18:40 +0000

Richard Stallman <rms@gnu.org> writes:

>   > > (pcase '(1 2 3)
>   > >   ((app cdr `(2 ,c)) (format "Match: %S" c)))
>
> cond* can do this without introducing a special feature for it:
>
>   (cond* ((match* `(2 ,c) (cdr '(1 2 3)))
>           (format "Match: %S" c)))

What about

(pcase '(1 2 3)
  ((and `(1 . ,_)
   (app cdr `(2 ,c)))
     (format "Match: %S" c)))

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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