emacs-devel
[Top][All Lists]
Advanced

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

Re: Instead of pcase


From: Ihor Radchenko
Subject: Re: Instead of pcase
Date: Thu, 28 Dec 2023 13:05:34 +0000

Richard Stallman <rms@gnu.org> writes:

>   > >      (> num-foos min-foos)  ; Match any number greater than MIN-FOOS,
>   > >                             ;  bind `num-foos' to it.
>
>   > But this is confusing - which symbol to bind and which one to eval is
>   > based purely on position in the ,(PRED ...) pattern.
>
> As this states
>
>     > Constrained variable: (PRED VARIABLE)  or, more generally,
>     >                       (PRED VARIABLE OTHER-ARGS...)
>
> the pattern variable to bind is always the second element of that list
> ...
> Is it clear now what that pattern means?
> Can you suggest what aspects of that (or other) text to improve?

I did not mean that I do not understand the description of PRED form.
I just find the syntax you proposed confusing - it is too similar to the
ordinary Elisp forms. Especially when we start nesting "constrained
variable" constructs.

For example, consider matching a list of two integers where the second
element is both larger than the first and also divisible by 5 when
subtracted variable DEC:

`(,(integerp smaller) ,(> (= (mod (- (integerp bigger) dec) 5) 0) smaller))

-- 
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]