From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.user Subject: Re: Macro for replacing a placeholder in an expression Date: Fri, 05 Aug 2022 11:42:20 +0200 Message-ID: <18fd1f47-0fac-420b-bb4f-37eddaa5315f@www.fastmail.com> References: <80083c86-19b0-7537-be70-f763bd5b390f@posteo.de> <1ede5481-9d46-84e9-2530-d64ac835568b@telenet.be> <5f0efafc-3045-e710-6066-9519692ebb44@posteo.de> <51f4c121-6143-345e-43d4-6f97e0be8501@telenet.be> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7297"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.7.0-alpha0-758-ge0d20a54e1-fm-20220729.001-ge0d20a54 Cc: "Guile User" To: "Maxime Devos" , "Zelphir Kaltstahl" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Aug 05 12:12:30 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oJuJh-0001cu-LE for guile-user@m.gmane-mx.org; Fri, 05 Aug 2022 12:12:30 +0200 Original-Received: from localhost ([::1]:52936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oJuJg-0001YN-Jd for guile-user@m.gmane-mx.org; Fri, 05 Aug 2022 06:12:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJtqz-00034p-GD for guile-user@gnu.org; Fri, 05 Aug 2022 05:42:49 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:41425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oJtqx-00021w-8o for guile-user@gnu.org; Fri, 05 Aug 2022 05:42:49 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 913EB5C0134; Fri, 5 Aug 2022 05:42:41 -0400 (EDT) Original-Received: from imap51 ([10.202.2.101]) by compute4.internal (MEProxy); Fri, 05 Aug 2022 05:42:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1659692561; x= 1659778961; bh=hK+/MYQC4rz+tj8mBGYm2weVxUmvF+fQYx7UtN4M7cE=; b=b UNjRxp//ePj/+vmLeZkyI6l2pkcDw/uZ+NB7wzaYVGe0y9HpfFdYM7qLOBIdZGwh 8W/N7wgOyLYus3yXlu1c6EPorO8v4hTZ9rNy1CgIpuU+N9uo4fHS/a98WQN3iq34 bSgAjT9djgkyXQLaXfqtFuclWohAbdILSZADJBOZEAt1N53Tb1SfeBA4Z+1BwZJ7 fQ9OoXBuKE30E97EDqnIlnHCl+wyWCZ8ZsqiPJOFNVToTDqcDfYgRx4GQneSnNaS 4oPhy7tKicz01JgE6+5JK/CnV5LPd96pTgJW7hi1YKuOed3erzKgVmfSdGc7/NOW tQ1B4ipSzjZmGVCufCTBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1659692561; x= 1659778961; bh=hK+/MYQC4rz+tj8mBGYm2weVxUmvF+fQYx7UtN4M7cE=; b=M robrHDfkqQNqeqtgzYJaKsu1b5/TZMGigoNdWoOMnk/TqjaYlJc3ljZZiX8TrasV knJfWhCz7mVlzOXLT2MxeDfoua7ZXFdzNczGw08Ahlh04nnoRB0hS10WLU0lkTK9 z6ZovaWW6lYKqa2KX4F0tH40P2hMn/6buroqki/B8OXuHghXjL8Zf8ix+2BA0MrM HLAwAUqOYXtMamscAgNxVIzm2MJZPChPAdPWzusWgnxrauH4Tsj5+Vtbp9/jwtD6 /ff8qDS3h9jKqf1qCTo1RJwvy7LOAH+AG8D1UVinVFtY+XxZlWKbjFENfaJ3LZi7 95TpOcxDqhZ9qRyDSTjJw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdefuddgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepnfhi nhhushgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdhinhhtvghrnhgvthesfhgrshhtmh grihhlrdhsvgeqnecuggftrfgrthhtvghrnhepieehhffhtdejgfekueeghfdthfffheet vefgjeffgeeuhefhieeltddvgfeuveehnecuffhomhgrihhnpehsrhdrhhhtpdhgnhhunh gvthdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehlihhnuhhsrdhinhhtvghrnhgvthesfhgrshhtmhgrihhlrdhsvg X-ME-Proxy: Feedback-ID: i57f3436d:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 61513B6041E; Fri, 5 Aug 2022 05:42:41 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: <51f4c121-6143-345e-43d4-6f97e0be8501@telenet.be> Received-SPF: pass client-ip=66.111.4.27; envelope-from=linus.internet@fastmail.se; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:18487 Archived-At: I wrote this, which does a tree fold over a sexp: https://hg.sr.ht/~bjoli/megacut/browse/readme.txt?rev=3Dtip It is unhygienic currently, and I will probably never change because I o= nly use it at the repl.=20 The code is really just a syntax-case version of the fast and efficient = flatten algorithm, but without flattening.=20 --=20 Linus Bj=C3=B6rnstam 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=20 >> is impossible? To expand to subforms being the same macro again and=20 >> this way transform a whole tree of s-expressions? >> > You can have recursive macros, see e.g. the let^ macro at=20 > . > > However, I do not see a way to implement recursivity the same way for=20 > your macro. > > Greetings, > Maxime. > > > Attachments: > * OpenPGP_0x49E3EE22191725EE.asc > * OpenPGP_signature