[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro for replacing a placeholder in an expression
From: |
Linus Björnstam |
Subject: |
Re: Macro for replacing a placeholder in an expression |
Date: |
Fri, 05 Aug 2022 11:42:20 +0200 |
User-agent: |
Cyrus-JMAP/3.7.0-alpha0-758-ge0d20a54e1-fm-20220729.001-ge0d20a54 |
I wrote this, which does a tree fold over a sexp:
https://hg.sr.ht/~bjoli/megacut/browse/readme.txt?rev=tip
It is unhygienic currently, and I will probably never change because I only use
it at the repl.
The code is really just a syntax-case version of the fast and efficient flatten
algorithm, but without flattening.
--
Linus Björnstam
On Sat, 30 Jul 2022, at 23:13, Maxime Devos wrote:
> On 30-07-2022 17:42, Zelphir Kaltstahl wrote:
>>
>> Does this mean, that recursive application of a macro inside a macro
>> is impossible? To expand to subforms being the same macro again and
>> this way transform a whole tree of s-expressions?
>>
> You can have recursive macros, see e.g. the let^ macro at
> <https://git.gnunet.org/gnunet-scheme.git/tree/gnu/gnunet/utils/hat-let.scm>.
>
> However, I do not see a way to implement recursivity the same way for
> your macro.
>
> Greetings,
> Maxime.
>
>
> Attachments:
> * OpenPGP_0x49E3EE22191725EE.asc
> * OpenPGP_signature
- Re: Macro for replacing a placeholder in an expression,
Linus Björnstam <=