From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.user Subject: Megacut - a clojure-like lambda shorthand Date: Tue, 26 Mar 2019 16:22:52 -0400 Message-ID: <67c9d51c-6b52-4703-b87d-18225297eaf2@www.fastmail.com> Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="208038"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Cyrus-JMAP/3.1.5-976-g376b1f3-fmstable-20190314v3 To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 26 21:28:39 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8sgY-000rxo-Eo for guile-user@m.gmane.org; Tue, 26 Mar 2019 21:28:39 +0100 Original-Received: from localhost ([127.0.0.1]:37573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8sgX-0003Bk-7O for guile-user@m.gmane.org; Tue, 26 Mar 2019 16:28:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h8sft-00038h-Fj for guile-user@gnu.org; Tue, 26 Mar 2019 16:27:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h8sb1-0004uD-Fr for guile-user@gnu.org; Tue, 26 Mar 2019 16:22:56 -0400 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]:59191) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h8sb1-0004kB-5S for guile-user@gnu.org; Tue, 26 Mar 2019 16:22:55 -0400 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 322CC22C06 for ; Tue, 26 Mar 2019 16:22:53 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute1.internal (MEProxy); Tue, 26 Mar 2019 16:22:53 -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=fm2; bh=fYJX84iH54tXPOleyeaFgrmMPj JtcIyp8n49w0P5Fiw=; b=vWAsJPq4rkXWXBSVPSroDeWoQZXCEn69C4xvz54cpR CiaoEi6B5aHvXBwXjwAaHcIzakJQ5amXdD6v0pIyXTkTTNSGbYiSGeIV1QVTjrKa w1AtbEgrUJONRrClblDcRXYFXuiAZCV/OvDIZkx2tS6K2GB3nDg+AMEtgrV4E28J GWdApNPLWobEP3mSOfDFTcy5iNjHXMAy6PsCbJUbSulGT2IqDxSS1bZ/Ou8KcpAn OhXk0Q0Hjv4E7VyUgCsD13NXUuac2qo7h8fyOmmwdmmIVZ/VsmVpdoI5KTKuQ7zh 8Itm49ko1QhNc/+gdxQRZywixknzjZKj5zY7NQZBEmpg== 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=fYJX84 iH54tXPOleyeaFgrmMPjJtcIyp8n49w0P5Fiw=; b=e2LUWaAKAmLAJHMQ5Kujra +aQ6k+QSf+CjsHB8w2u/xitTmVk8gg9EzHKqsNAhUoEHbbSN+MuiemsGfskEV3xk 9vqzd3IA+IFHVlgUyzTX4b+9uhLzV27YjR6GHjr4p3wpbUIqaux7ICjTjwykacQl i4aRBxH0tJFOC0eF8l1rEtnumuZIlt8q0AS3C0WKPQzH8gtw+1Nf2LLgD4yvmSOq QzroeWHwWdlJ+D86THVXF09tveDY6LBlGzoN7+bh2WR/WL/EG/BrnANgOxv9S4Rl Y8YFZMj/bqAHawo7P1YlYeRZ3aNClBtuVo+7idXErQVpK8NcGIbgi9iaEwXvT+TQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrkedtgddutdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtgfesthhqre dtreerjeenucfhrhhomhepnfhinhhushgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdhi nhhtvghrnhgvthesfhgrshhtmhgrihhlrdhsvgeqnecuffhomhgrihhnpegsihhtsghutg hkvghtrdhorhhgnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlihhnuhhsrdhinhhtvghr nhgvthesfhgrshhtmhgrihhlrdhsvgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id B44C7D4873; Tue, 26 Mar 2019 16:22:52 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface X-Me-Personality: 46359082 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.27 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15372 Archived-At: Hello everybody! I have written a bunch of small libraries to scratch some itches, and I = thought now might be a good time to actually release them here.=20 Megacut is the first of a few. It is a lambda shorthand, like cut, but w= ith different semantics and more features: (megacut (apply + (/ %1 %2) %&)) (lambda (%1 %2 . %&) (apply + (/ %1 %2) %&)) Using guile's read-hash-extend #%(+ %1 %2) gets expanded to (megacut (+ = %1 %2)). The workings are simple: positional arguments are %n (where n is a posit= ive integer) and rest arguments are %&. It adds as many positional argum= ents as n is big so #%(display %2) becomes (lambda (%1 %2) (display %2))= .=20 The symbol % is a shorthand for %1, so #%(+ % %) is the same as #%(+ %1 = %1). It can be found here: https://bitbucket.org/bjoli/megacut Play with it if you want. It is licensed under a BSD-styled license. My = linux box died recently, so I haven't been able to package it for guix. Best regards Linus Bj=C3=B6rnstam