help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: pcase on multiple conditions


From: Jean Louis
Subject: Re: pcase on multiple conditions
Date: Fri, 28 Oct 2022 15:05:19 +0300
User-agent: Mutt/2.2.7+37 (a90f69b) (2022-09-02)

* Michael Heerdegen <michael_heerdegen@web.de> [2022-10-28 10:46]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > * Heime <heimeborgia@protonmail.com> [2022-10-28 09:49]:
> > > Is this the way to test for two values to perform the same operation?
> > > 
> > >  (pcase complt
> > > 
> > >     ((or 3 4)
> > > 
> > >        (myfunc)))
> >
> > With `or' it will become true if any of values is true.
> 
> `pcase' patterns are not values.  Your interpretation of the semantics
> of this `or` pattern is wrong.

I actually skipped to think of pcase, but mentioned only `or' in
general.

(let ((my-number (read-number "Number: ")))
  (pcase my-number
    ((or 3 4) (message "Yes, it is 3 or 4"))
    (t (message "Not 3 or 4")))) ⇒ "Not 3 or 4" for entry of 5

So why this does not work?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

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