[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Instead of pcase
From: |
Richard Stallman |
Subject: |
Re: Instead of pcase |
Date: |
Tue, 19 Dec 2023 22:28:03 -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. ]]]
I find these examples hard to understand because of the complexity
caused by the functions called `bar'. I could not fully make sense of
the first one: I don't understand what you intend it to do, or what
you think it might do, or why it might do that.
It is indeed painfully complex, but I don't think that is the fault of
cond*.
Is it possible that the explanation of a constrained variable patterm
is not clear?
Constrained variable: (TESTFN VARIABLE OTHER-ARGS...)
This matches any value VALUE provided (TESTFN VALUE OTHER-ARGS...)
evaluates to true. If so, it sets VARIABLE to VALUE.
(symbolp sym) Match any symbol, store it in `sym'.
(> num-foos 1) Match any thing greater than 1, store it in
`num-foos'.
Only the first argument to a TESTFN is a kind of subpattern. The
OTHER-ARGS are handled are not patterns to match; they are expressions
to evaluate. Their values are passed to TESTFN as in an ordinary
function call.
If TESTFN is your function `bar', it will then receive its arguments
in the usual way and do what it is defined to do. It is used as a
predicate, so all that matters is whether its return value is non-nil.
The first parameter of `bar' will be data that this subpattern
may match or not. The remaining parameters of `bar' will be the
results of evaluating OTHER-ARGS...
--
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: cond*, (continued)
- RE: [External] : Re: cond*, Drew Adams, 2023/12/19
- Re: [External] : Re: cond*, Richard Stallman, 2023/12/20
- Re: [External] : Re: cond*, Richard Stallman, 2023/12/20
- cond*, Richard Stallman, 2023/12/17
- Re: cond*, Adam Porter, 2023/12/18
- Re: cond*, Richard Stallman, 2023/12/20
- Re: Instead of pcase, Richard Stallman, 2023/12/15
- Re: Instead of pcase, Adam Porter, 2023/12/16
- Re: Instead of pcase,
Richard Stallman <=
- Re: Instead of pcase, Adam Porter, 2023/12/20
- Re: Instead of pcase, Richard Stallman, 2023/12/22
- Re: Instead of pcase, Ihor Radchenko, 2023/12/25
- Re: Instead of pcase, Richard Stallman, 2023/12/26
- Re: Instead of pcase, Ihor Radchenko, 2023/12/28
- Re: Instead of pcase, Richard Stallman, 2023/12/29
- Re: Instead of pcase, Richard Stallman, 2023/12/22
- Re: Instead of pcase, Richard Stallman, 2023/12/12
- Re: Instead of pcase, Richard Stallman, 2023/12/10