[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: combining cond and let, to replace pcase.
|
From: |
Richard Stallman |
|
Subject: |
Re: combining cond and let, to replace pcase. |
|
Date: |
Sun, 26 Nov 2023 22:11:47 -0500 |
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> > ;; Extracts substructure and binds variables around the rest
> > ;; of the cond*.
> > (:match (`(expt ,foo ,bar) x)
> > do-this-if-it-matched-then-exit...)
> > ;; Bindings continue in effect.
> Which bindings? Presumably when we continue the match failed, so `foo`
> and `bar` don't have any meaningful value to take, AFAICT.
That is a good question.
I've concluded that, for this form of the clause, which will exit if
it executes the body of the clause, the bindings should be made only
for that clause.
> > ;; Like above but always falls thru to next clause.
> > (:match (`(expt ,foo ,bar) x))
> > ;; Bindings continue in effect.
> What happens if `(car x)` is not equal to `expt` or if `x` is a string?
This form of clause should bind the variables unconditionally. If
matching provides a value to give a certain variable, the variable
should get that value. Otherwise it should be bound to nil.
This way, which variablss are bound at any point will not depend on
the valus of the data.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
- Re: combining cond and let, to replace pcase., (continued)
- Re: combining cond and let, to replace pcase., Manuel Giraud, 2023/11/23
- Re: combining cond and let, to replace pcase., Richard Stallman, 2023/11/25
- Re: combining cond and let, to replace pcase., Daniel Semyonov, 2023/11/23
- Re: combining cond and let, to replace pcase., Daniel Semyonov, 2023/11/23
- Re: combining cond and let, to replace pcase., Richard Stallman, 2023/11/24
- Re: combining cond and let, to replace pcase., Stefan Monnier, 2023/11/25
- Re: combining cond and let, to replace pcase., Richard Stallman, 2023/11/26
- Re: combining cond and let, to replace pcase.,
Richard Stallman <=
- Re: combining cond and let, to replace pcase., Manuel Giraud, 2023/11/27
- Re: combining cond and let, to replace pcase., Yuri Khan, 2023/11/27
- Re: combining cond and let, to replace pcase., Stefan Monnier, 2023/11/27
- Re: combining cond and let, to replace pcase., Richard Stallman, 2023/11/28
- Re: combining cond and let, to replace pcase., Richard Stallman, 2023/11/28
Re: Instead of pcase, Jim Porter, 2023/11/16