[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56875: 29.0.50; [PATCH] Add thread-as macro
From: |
Augusto Stoffel |
Subject: |
bug#56875: 29.0.50; [PATCH] Add thread-as macro |
Date: |
Fri, 05 Aug 2022 09:44:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
On Tue, 2 Aug 2022 at 23:47, Richard Stallman <rms@gnu.org> wrote:
> [[[ 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. ]]]
>
> > + (thread-as x
> > + 4
> > + (- 10 x)
> > + (/ x 2))
>
> I propose a different syntax which is more Lispy than thread-as, and
> more self-evident:
>
> (let-successive ((x 4
> (- 10 x)))
> (/ x 2))
>
> A Lisper can guess what it means, without having read a description.
>
> It lends itself to a generalization where there is more than
> one bound variable, each of which can have several values:
>
> (let-successive ((x 4
> (- 10 x))
> (y 6
> (- 12 y)))
> (* x y))
> => 36
>
> The values after the first can refer to all of the variables,
> since all of them are already bound (to the previous values)
> at that point.
This is an interesting alternative. I'd suggest to wait for other
opinions about the need for this kind of macro in general, and which
variant is preferred.