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: Announcement: goof-loop 0.1 Date: Tue, 11 May 2021 14:26:16 +0200 Message-ID: <8235e1cd-3fe1-4345-83db-a7c123801895@www.fastmail.com> 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="39507"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-448-gae190416c7-fm-20210505.004-gae190416 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue May 11 14:37:28 2021 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 1lgRdf-000A6X-Ib for guile-user@m.gmane-mx.org; Tue, 11 May 2021 14:37:28 +0200 Original-Received: from localhost ([::1]:54784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgRde-0005dz-Jm for guile-user@m.gmane-mx.org; Tue, 11 May 2021 08:37:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgRTL-0003Gd-6y for guile-user@gnu.org; Tue, 11 May 2021 08:26:47 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgRTJ-0004l1-GY for guile-user@gnu.org; Tue, 11 May 2021 08:26:47 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 2AF525C00FB for ; Tue, 11 May 2021 08:26:43 -0400 (EDT) Original-Received: from imap42 ([10.202.2.92]) by compute6.internal (MEProxy); Tue, 11 May 2021 08:26:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= mime-version:message-id:date:from:to:subject:content-type :content-transfer-encoding; s=fm3; bh=0MLHRPJPGL/jfxzdhWYafyzm+0 PMZXVFY8yJ4WvaeME=; b=EF/rAHFKpXxFP1bJ/BnCXqBnf9IG3n7VMEExsTEpee IGL+l5TanpwMY9klm2Oplbefff+hTSLAaKW+7ZSjd/rBye6HsWvO0wBDsMgZFfEf wZlX7oqgYb+1KlLbsMdH/acF67y9gYhJgekOfbAln/uDeLI7tiUHVxtFHPT+6eeQ tAY4LukGE8jSf2IqV/w+x0CVTjnK4rCpoeBFA0fFzH+MmfJBNRZbEUPF91cPZ3jz scQC+NvMbvwQ7lw717K13uRWuyDQrbGGppwzljIH4fVuskkU8x/+q/KTLgrahosY ayk5drYXj7lFTsD47v1Rp/pkVODurwBm4CN/mCyktGMQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=0MLHRP JPGL/jfxzdhWYafyzm+0PMZXVFY8yJ4WvaeME=; b=MOCtf245dJWgEXy+z1mcah FKJXDmNT4lWYD4byqLMaQVVvCklCRQDCxI5/6pEfRzAf/dDSXX4ECaz3jzdhEUhC 31y5xw6zZSqOhm4iecTcDqvmeGdVfhm5c/DTU85C1nns8csjzo+jOn9i0RDbx8wl WI/kK9cxaa59K5nHX74xudxaQ1/augdJOA/oFSKdSu1jLQI2/E44CZFz4UnVrZ/y tNM6jjS11H/NQLqxaNf9h5SLOInGlgbRuMAPi5PBrvales+khTDHg/JBeAn/Cg5g 98kxJzc5+bX50nVd6MeCcTMW76BUFtKpwCo3xJfhvL0jVjAhCKergy9nVrN8+yTw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdehtddgheefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtgfesthhqre dtreerjeenucfhrhhomhepnfhinhhushgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdhi nhhtvghrnhgvthesfhgrshhtmhgrihhlrdhsvgeqnecuggftrfgrthhtvghrnhepudegle etkeegieefheejheelgefhieeiieffffdugeeuuddvveeiheduheekveevnecuffhomhgr ihhnpehsrhdrhhhtpdhsrhhhthdrshhithgvnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheplhhinhhushdrihhnthgvrhhnvghtsehfrghsthhm rghilhdrshgv X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id B8A70310005F; Tue, 11 May 2021 08:26:42 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Received-SPF: pass client-ip=66.111.4.27; envelope-from=linus.internet@fastmail.se; helo=out3-smtp.messagingengine.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.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, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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:17524 Archived-At: Hello Friends! I am rather pleased to announce the first beta release of goof-loop, an = extensible, powerful and fast looping facility for (guile) scheme. It is= based on (chibi loop), but adds quite a bit of nice things - most notab= ly subloops and a higher order loop protocol based on srfi-158-styled ge= nerators.=20 The repo can be found here: https://git.sr.ht/~bjoli/goof-loop Hosted documentation: https://bjoli.srht.site/doc.html If you are familiar with racket's for loops, you will find these pretty = similar, more verbose, and more powerful. Some examples to show highligh= ts compared to racket's loops and foof-loop: Subloops and accumulators in all loop stages: (loop ((:for a (in-list '(1 2 3))) (:acc aa (summing a)) :subloop (:for b (up-from a (to (+ a 2)))) (:acc ab (listing b))) =3D> (values aa ab)) ;; =3D> 6 (1 2 2 3 3 4) Loop clauses that refer to eachother, here producing a list of fibonacci= numbers: (loop/list ((count (up-from 0 100)) (a (in 1 b))=20 (b (in 1 (+ a b)))) a) Named updates (shamelessly stolen from Taylor Campbells foof-loop docume= ntation): (define (partition list predicate) (loop continue ((:for element (in-list list)) (:acc satisfied (folding '())) (:acc unsatisfied (folding '()))) =3D> (values (reverse satisfied) (reverse unsatisfied)) (if (predicate element) (continue (=3D> satisfied (cons element satisfied))) (continue (=3D> unsatisfied (cons element unsatisfied)))))) Pattern matching, here extracting all keys in an alist (loop/list (((key . val) (in-list '((a . 0) (b . 1) (c .2))))) key) Higher order loop protocol (for the :for clause scheme-value) (loop/list ((key (in-list '(true false sant falskt wahr falsch vrai faux= ))) (scheme-value (in-cycle (in-list '(#t #f))))) (cons key scheme-value)) The loop expansion is usually as fast as a named let. You can find a lot more tofu in the readme and documentation. best regards Linus Bj=C3=B6rnstam