From: "Linus Björnstam" <linus.internet@fastmail.se>
To: "Maxime Devos" <maximedevos@telenet.be>,
"Zelphir Kaltstahl" <zelphirkaltstahl@posteo.de>
Cc: "Guile User" <guile-user@gnu.org>
Subject: Re: Macro for replacing a placeholder in an expression
Date: Fri, 05 Aug 2022 11:42:20 +0200 [thread overview]
Message-ID: <18fd1f47-0fac-420b-bb4f-37eddaa5315f@www.fastmail.com> (raw)
In-Reply-To: <51f4c121-6143-345e-43d4-6f97e0be8501@telenet.be>
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
next prev parent reply other threads:[~2022-08-05 9:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 23:57 Macro for replacing a placeholder in an expression Zelphir Kaltstahl
2022-07-28 0:55 ` Maxime Devos
2022-07-28 10:23 ` Zelphir Kaltstahl
2022-07-28 10:28 ` Maxime Devos
2022-07-30 15:42 ` Zelphir Kaltstahl
2022-07-30 20:44 ` Maxime Devos
2022-07-30 21:10 ` Maxime Devos
2022-07-30 21:13 ` Maxime Devos
2022-08-05 9:42 ` Linus Björnstam [this message]
2022-08-06 14:28 ` Zelphir Kaltstahl
2022-07-28 1:04 ` Maxime Devos
2022-07-28 8:39 ` Zelphir Kaltstahl
2022-07-28 9:48 ` Maxime Devos
2022-07-28 11:26 ` Zelphir Kaltstahl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18fd1f47-0fac-420b-bb4f-37eddaa5315f@www.fastmail.com \
--to=linus.internet@fastmail.se \
--cc=guile-user@gnu.org \
--cc=maximedevos@telenet.be \
--cc=zelphirkaltstahl@posteo.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).