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: Loop macros (was: Re: macro definition for continue and break) Date: Mon, 12 Sep 2022 23:09:10 +0200 Message-ID: <4d348f3d-2674-4221-b2a3-b086c42405cc@www.fastmail.com> References: 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="10586"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.7.0-alpha0-929-g09f3e68182-fm-20220908.004-g09f3e681 Cc: "Guile User" To: "Maxime Devos" , "Jean Abou Samra" , "Damien Mattei" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Sep 12 23:10:34 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 1oXqhM-0002Wy-N9 for guile-user@m.gmane-mx.org; Mon, 12 Sep 2022 23:10:34 +0200 Original-Received: from localhost ([::1]:59972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXqhL-0006fo-AW for guile-user@m.gmane-mx.org; Mon, 12 Sep 2022 17:10:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXqgc-0006fI-PV for guile-user@gnu.org; Mon, 12 Sep 2022 17:09:46 -0400 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXqga-00070i-Kg for guile-user@gnu.org; Mon, 12 Sep 2022 17:09:46 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A44625C0125; Mon, 12 Sep 2022 17:09:42 -0400 (EDT) Original-Received: from imap51 ([10.202.2.101]) by compute4.internal (MEProxy); Mon, 12 Sep 2022 17:09:42 -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=fm2; t=1663016982; x= 1663103382; bh=yY++AZlVEdqa66FLu/BMaP1P0R+ln0t0uaxr0BljcoM=; b=V 0pI4+4E/w9+XHEY/aMu7CrYjlwDZwT+X6mfgtw/fDlr0Jl4zL5S6jEi40WVX0FMO V3t+D9qG3k8HCHEK35p5c2C2RH3N1O7/FmfvFR/qBo0oBXLngqAnTbOeAqoovl1I oKvffQHAiHdaE/j6IqsCx+vt+296eNgJJpP69o1TDm2vA5dPthIdZgGNBhzNEfjL QeUIPcOnb7tMH/EifqHwzGP+it7TwscRzQPHZREoRmnv9tSTPHL7bX4USZUc0fca ZaQEkg6R3G0fEjQ1RmjD/YPy1Xt2fpceuIx7y7bh2i9ZSVrLBQi/XuZa09oUm2An WkA/AJap2uHNKFjC0SroQ== 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=fm2; t=1663016982; x= 1663103382; bh=yY++AZlVEdqa66FLu/BMaP1P0R+ln0t0uaxr0BljcoM=; b=t F5Zmqy7wYgPY7T7MktHtDDXQU5HUABBz+nFNw28rXK8AuhsOQoQ8waeoVMmGIUGx QjLlgeP+Y4n6VqjA+omNiiR+s3Oj4nEIqjv6RW+JKHbThgJh1W57o6EUht+Br3Vf b07OfmG4C5Pm5HAbgyrEC5D2ZlwNa1+xqkDo1Hc8tepMD/8UMRqJkakBaDznd8tL GayjoWUny/SGgqXH55bkHrcEgDnrz+lbR4yLLcyz0rlgxjAf4btH1p5lTgvPjYVG sUmBt6+wtvdkdFXMqONpw9l9ZujOf8mf5I6u/V66cAZEwqausOHB60JiA914RPXp p0i3zIwyRXsavSeCWbdMg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeduvddgudeiudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgfgsehtqhertderreejnecuhfhrohhmpefn ihhnuhhspgeujhpnrhhnshhtrghmuceolhhinhhushdrihhnthgvrhhnvghtsehfrghsth hmrghilhdrshgvqeenucggtffrrghtthgvrhhnpeeihefhhfdtjefgkeeugefhtdfhffeh teevgfejffegueehhfeiledtvdfgueevheenucffohhmrghinhepshhrrdhhthdpghhnuh hnvghtrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomheplhhinhhushdrihhnthgvrhhnvghtsehfrghsthhmrghilhdrshgv X-ME-Proxy: Feedback-ID: i57f3436d:Fastmail Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 65E7DB60086; Mon, 12 Sep 2022 17:09:42 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.25; envelope-from=linus.internet@fastmail.se; helo=out1-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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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:18586 Archived-At: I would say it is mostly an extension of foof-loop with the addition of = subloops. It is also written mostly in syntax-rules, which makes is port= able. I am not happy with the extensibility outside the possibility to add :fo= r and :acc clauses, since it is pretty darn awful do do any changes to t= he internals. I have a couple of things I want to sort out, but the source code has st= arted to scare me.=20 --=20 Linus Bj=C3=B6rnstam On Mon, 12 Sep 2022, at 22:57, Maxime Devos wrote: > On 12-09-2022 21:19, Linus Bj=C3=B6rnstam wrote: >> If you want a bit more advanced looping you could have a look at my g= oof-loop: https://git.sr.ht/~bjoli/goof-loop >>=20 >> It currently does not support a break or continue clause, but adding = one should not really be a problem. >>=20 >> A good thing is that it does not rely on mutation for anything except= higher order sequences, meaning it does not lead to the implicit boxing= overhead of set!, which is a good idea in loops since that quickly adds= up. >>=20 >> Best regards >> Linus Bj=C3=B6rnstam > > I also have a mutation-free loop macro, named 'hat-let' or 'let^': > > https://git.gnunet.org/gnunet-scheme.git/tree/gnu/gnunet/utils/hat-let= .scm > > Its origin is rather different though, goof-loop appears to be the=20 > result of combining various loop-related constructs, plus some extras,=20 > whereas let^ is the result of combining various binding constructs=20 > (including the 'let loop'), plus some extras. > > It combines the following: let*, lambda / define, receive, 'let loop',=20 > 'if', 'begin'. > > Doesn't do any accumulation though. > > Greetings, > Maxime. > > Attachments: > * OpenPGP_0x49E3EE22191725EE.asc > * OpenPGP_signature