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: "Missing" libraries/concepts found in other languages/ecosystems? Date: Sat, 11 Jul 2020 16:46:22 +0200 Message-ID: References: <20200710112109.b2ffa630699452541835924b@gmail.com> <14a24bd8-2664-c7bf-eff8-ca3f4e068ef8@posteo.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="712"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.3.0-dev0-613-g8a73ad6-fm-20200709.001-g8a73ad6e Cc: Guile User To: "Zelphir Kaltstahl" , Catonano , "Chris Vine" Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Jul 11 16:47:04 2020 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 1juGmM-000AYg-O7 for guile-user@m.gmane-mx.org; Sat, 11 Jul 2020 16:47:04 +0200 Original-Received: from localhost ([::1]:38474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juGmL-0007eb-PX for guile-user@m.gmane-mx.org; Sat, 11 Jul 2020 10:47:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juGmB-0007eV-FU for guile-user@gnu.org; Sat, 11 Jul 2020 10:46:51 -0400 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]:48487) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juGm8-0006EK-Sz for guile-user@gnu.org; Sat, 11 Jul 2020 10:46:51 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 2376A5C0084; Sat, 11 Jul 2020 10:46:45 -0400 (EDT) Original-Received: from imap1 ([10.202.2.51]) by compute4.internal (MEProxy); Sat, 11 Jul 2020 10:46:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.se; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm3; bh=z7+3PtaNCnXIofbscFTmkvFAG791CuL bwNPEBM4QNdU=; b=p2dLTJvHTQscemhIwDBG15U0nqc3WFVPtes4ijm6p638t/A MJxPRcezeYABo5XGsLGyz/xolgL8pVMx1mchSSr+4oBthU/tuv7Zyw60UNlCCpa7 LSVk616u24sHRVv5xS+3L4Dn50foehPCjL5jSb7iw8HCIUJ2n0Usvuw5q6L7poz6 fJLZ+iPn6cxibViWa3JnP/AzTiNAzQ/k4esQ0oc7zZSrOXjOtbr15oUy4gbw/Rtd 5wkFCxZWR582oFfduOAtnp6iiN4f26U1FNYkAXmGzY/8HkHklrivKispt5orTmxK 4VCGNBBxbi8wTSs288e90jld78g07zsVy4cfo5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=z7+3Pt aNCnXIofbscFTmkvFAG791CuLbwNPEBM4QNdU=; b=iVg6Hk/F67aL5HyJ2Y8bHk XNmGylUID/3+hD5lbPPWDB340SDCafa7ModocZcs2KwXa4vEAd6e//acgCNS4YmZ oIYoRMc18Lk8T8G8DZpbrcmBvK5AAjYEPXzceJ74WVALc/AxdFGW7m264nfcPxkV XHOH64WD16AxSue0xmOEzbQgwsWcYR+B01dG3k2nO0aKFPz0LfDYUTv/IzSe7zDU DbrrW2xA0txEJSkgPU1ury0/4i1ITT2e3ym4vskdiSvVdvb/Ax5jpmrCxcnV8uTU lS4Gl13x170c6D3CuocyCCg2iznveS5OiLP9IjcI6Tzes0aWdQOxEI9re0VPJyHw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrvdefgdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculddugedmnecujfgurhepofgfggfkjghffffhvffutgesthdtredtreer jeenucfhrhhomhepnfhinhhushgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdhinhhtvg hrnhgvthesfhgrshhtmhgrihhlrdhsvgeqnecuggftrfgrthhtvghrnhepffeuveekhfdt gefhjefgheeiledvueevveetleetgeffudegheffheefhfehffdtnecuffhomhgrihhnpe hsuhhlrghmihdrgiihiidprhgvrggtthhivhgvgidrihhopdhnohhtrggsuhhgrdhorhhg pdhgnhhurdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomheplhhinhhushdrihhnthgvrhhnvghtsehfrghsthhmrghilhdrshgv X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 972BAC200A5; Sat, 11 Jul 2020 10:46:44 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.29; envelope-from=linus.internet@fastmail.se; helo=out5-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/11 10:46:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham 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:16664 Archived-At: On Sat, 11 Jul 2020, at 02:34, Zelphir Kaltstahl wrote: > The comments about exception handling also reminded me of the following > blog post: > > https://blog.sulami.xyz/posts/common-lisp-restarts/ > > Pretty cool concept as well. > > If there anything like it in Guile or is something like it possible > (probably, right?)? I implemented a restart system in top of call/cc back in 2012, but that was slow and had some interesting (as in completely wrong) edge cases. Doing it with delimited continuations should be fast and a lot simpler. Someone took my code and made it useful for chez, and then I saw something that looked vaguely similar in one of the r7rs-large dockets. Anyway, it is possible and probably not more than 100loc to do it properly using continuations. > > > On 7/11/20 2:19 AM, Zelphir Kaltstahl wrote: > > Hi all! > > > > On 7/10/20 1:20 PM, Catonano wrote: > >> Il giorno ven 10 lug 2020 alle ore 12:21 Chris Vine > >> ha scritto: > >> > >>> On Fri, 10 Jul 2020 10:49:37 +0200 > >>> Catonano wrote: > >>>> Il giorno mer 8 lug 2020 alle ore 20:22 Zelphir Kaltstahl < > >>>> zelphirkaltstahl@gmail.com> ha scritto: > >>>> > >>>>> Hi Simen! > >>>>> > >>>>> On 7/8/20 6:00 PM, guile-user-request@gnu.org wrote: > >>>>>> Hi, I'm new to scheme/lisp, so I'm trying to find out how to do > >>>>>> things the "lisp > >>>>>> way". On the other hand, I like things from other ecosystems too, > >>>>>> and I'm having > >>>>>> problems finding this for Guile. It might be because there's no > >>>>>> need for it/I'm > >>>>>> terrible at searching/nobody had the time yet, or something else. > >>>>>> > >>>>>> I've been trying to find implementations for https://reactivex.io > >>>>>> without any > >>>>>> luck. And I'm unable to find implementation of FP concepts as > >>>>>> found in Haskell > >>>>>> and other languages. Functor, Monad, lenses (and other helpers for > >>>>>> working with > >>>>>> immutable data). > >>>>>> > >>>>>> Does things like this exists, or is it better to use something > >>>>>> else? > >>>>>> > >>>>>> Regards Simen > >>>>> To what others already have written I will add: > >>>>> > >>>>> From time to time one can copy ideas from Racket or look at what exists > >>>>> in Racket for solving a problem or seeing what the approach is. > >>>>> > >>>>> Catonano identified already the lack of examples in the Guile guide. I > >>>>> fight with that myself, so I created a repository with examples. > >>> Perhaps > >>>>> I should somehow add them to the guide. I've not looked into how to do > >>>>> that. Probably some commit in a repo somewhere for the guide: > >>>>> > >>>>> https://notabug.org/ZelphirKaltstahl/guile-examples > >>>>> > >>>>> Hope this can help! > >>>>> > >>>> Thank you, yes that helps > >>>> > >>>> In fact, it's a precious resource ! > >>>> > >>>> I was especially delighted with the examples of using exceptions ! > >>>> > >>>> I had so missed examples of those ! > >>>> > >>>> As for the manual, very recently a mention of Guile Hall ended up being > >>>> included in the manual > >>>> > >>>> The same could be done with your examples collection > >>>> > >>>> I also think that your collection could be mentioned by the Guile web > >>> site, > >>>> maybe in the "learn" section > >>>> > >>>> Here's the repo for the web site: > >>>> https://git.savannah.gnu.org/cgit/guile/guile-web.git/ > >>>> > >>>> a regular patch could do > >>>> > >>>> What do people think of mentioning this resource on the Guile web site ? > >>> Whilst I don't have strong feelings, as a general approach I think it is > >>> better to include additional examples (where needed) in the body of the > >>> manual, which I think is generally well written. > >>> > >> As long as some examples are reachable from an officially sanctioned > >> documentation source, I'm ok with that > >> > >> What I find problematic is the casualness in referring to bits scattered > >> all around > >> > >> The web site was just an idea, the manual would be perfectly fine > >> > >> Also, at this level of detail what some find helpful others don't. You > >>> were delighted above with the exceptions example, whereas (if I read > >>> the right one) I thought that that was one of the weaker ones. It > >>> concentrates on R6RS/R7RS exceptions and with-exception-handler rather > >>> than with guile's much easier to use catch expression (for guile-2.2) > >>> or (for guile-3.0) its beefed-up with-exception-handler and exception > >>> objects. > >>> > >> Ah there has been a misunderstanding here > >> > >> I was convinced that the exceptions example was of the last layout for > >> using exceptions reached recently in Guile 3.x > >> > >> If it's not, I agree it's less valuable > >> > >> But I think the author was just confused or led astray by the casualness of > >> referring to scattered bits, I'm not blaming them > >> > >> I'd be grateful if anyone with enough understanding of the issue would > >> contribute a proper example of how to use exceptions according to the last > >> exceptions reorganization in Guile 3.x > >> > >> I would be happy to send a patch for the manual containing such example and > >> a few words, as I did with the mention of Guile Hall > >> > >> > >> with-exception-handler is a tricky beast and the example didn't deal > >>> with the main case: most uses of exceptions involve handling them and > >>> moving on with program execution from the point where the exception is > >>> caught, and to do that using with-exception-handler instead of > >>> guile's 'catch' form you have to have a call/ec helper (or with > >>> guile-3.0 you can just set the #unwind argument to true). Instead you > >>> are left with the idea that you use continuable exceptions for that > >>> (which while they do stop the program exiting are something different) > >>> or the R6RS/R7RS guard form. > >>> > >> I'm not following you on this because I don't know enough of both the Guile > >> new idea of how to use exceptions and the R6/7RS one > >> > >> > >>> I am not trying to be critical here - I think examples are useful to > >>> convey points and some of them were fine. My point is more about venue. > >>> > >> No, that's ok, that's why I asked > >> > >> In fact, should we end up with a proper example in the manual, that would > >> be a positive outcome > >> > >> I'd say more, here > >> > >> I'd go systematically through all the examples in that repo and do a > >> similar assessment if we can add it to the manual as is or if it needs > >> refinement > >> > >> I can't do this on my own because in many cases I don't know enough to come > >> up with valid examples myself > >> > >> But I'd be happy to prepare patches for the manual, given the right > >> directions > > > > I would be glad, if any non-optimal example was extended or updated by a > > more knowledgeable person or I was told what I could improve in some > > example. The examples in the repository are only, what I was able to > > understand and I often find myself looking up, how to do something again. > > > > If anyone wants to take any example and put it in the docs, go ahead. > > Only don't think that my examples are the last word on how to do things. > > Far from it! > > > > About the exceptions thing: Aha! I should look into that again. I > > thought the "conditions" thing was already pretty cool and useful. Once > > an exception happens, you can react on it. I did not understand the > > "call/ec helper" part, but perhaps I can understand it, when I check the > > docs for the new exceptions in Guile 3. > > > > I had another thought: Why do we not create this kind of so called > > "awesome list" for Guile? There were some links in this discussion, > > which might be a good fit on such a list and it is kind of informal, > > easy to extend. Whenever someone asks for pointers, we could also > > mention that list and perhaps they can find cool things in it. They > > could see, that Guile is viable, because there are so many things people > > do with Guile, or they could see their use case covered already. > > > > Best regards, > > Zelphir > > > > > >