From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John Cowan Newsgroups: gmane.lisp.guile.user Subject: Re: Use core or SRFIs? Date: Thu, 24 Oct 2019 14:50:08 -0400 Message-ID: References: <9ef7ae59-a2b8-ea06-131c-569512409047@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="200677"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Guile User To: Zelphir Kaltstahl Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Oct 24 20:51:14 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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iNiCV-000pxz-O8 for guile-user@m.gmane.org; Thu, 24 Oct 2019 20:51:11 +0200 Original-Received: from localhost ([::1]:50782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNiCU-00006L-0d for guile-user@m.gmane.org; Thu, 24 Oct 2019 14:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52590) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNiBi-0008Or-OS for guile-user@gnu.org; Thu, 24 Oct 2019 14:50:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNiBh-0004B6-0I for guile-user@gnu.org; Thu, 24 Oct 2019 14:50:22 -0400 Original-Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]:45340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNiBg-0004Ae-MJ for guile-user@gnu.org; Thu, 24 Oct 2019 14:50:20 -0400 Original-Received: by mail-qk1-x72b.google.com with SMTP id q70so16860121qke.12 for ; Thu, 24 Oct 2019 11:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccil-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bH88S7n81oqr9/FhqHO1zEJRaQVaRKw+ay8DWGuu2gs=; b=g/jxOxCv4QB0BIFFg6ebO7D+oBtaDMvIoNCqJbD3vq49cTBD6h38IAiaHucX9Gjund 5tmRLzn1LGhZY50bRzrKbcl0zuzDGXiAuNzpCVVvFd4b3xCGgc/o54SUnB6r5sZCrjHZ Abo3zs/Is+TIRZ1ru2ZbXBa7yKUq4afbIMPYBbQpQKnnZbCPlMBP0Qc/HR2VJByv+eGH 78+AueftX6MaI7goO1nX6RKhYX0LDhYgdarfPtXfIOkxhvcgDBW6MKyDRlTH6Xt7BqWh 5RikX91gNDCE83mXKzTi71scdjtiEsmnnuDDU41jrhxJTSED7RH0H/zzOAPHs9prDHnX NJLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bH88S7n81oqr9/FhqHO1zEJRaQVaRKw+ay8DWGuu2gs=; b=ZC3LQrBfngwxsP34iNhnWpiyJycZwMrw0kNqMUKuGEI3qzy1hTBfexho1sQuxuyJIH BNQ6a3H5awPgwx8aeeVWRY3pbyCKqFtrBRb62wEGxvI79HtMUTqFCy0fRQNJ2rTxl/hA duURfCp/D7zSqU+x4cIdrcKF/FfKDysmKHFmuB5eKsGY3Ngq7/0h/w92o5w6Yq9fCefM NRHlNug8LcpitC3q2FTltsKx23x97bs8IjUKPKELwhW4uLxUFjafe59DTbrBdD1C3ANc Qw6mWXrE7MYQJQRu05bypzrgwyApucvME36QXasioAv0IAqrTpGB5upFmse5awNVuVWl Ps6w== X-Gm-Message-State: APjAAAX4tQvszuTRI2gdag9rC/HXSyfu9GcYDFPWBJFkTf/oHwIspVFX 9EA2MBQd6oPaP9KcJq5vs0EF17vS6ZUTz5usoJgUDg== X-Google-Smtp-Source: APXvYqwMjDS1Hxrqfc8phrcSRv1kmCI0w6aQt6YHJ1UclLMpgnh04f9m275B5PB5o7W0EHCKKcw1npwgXdgcxZNmgBs= X-Received: by 2002:a37:9c9:: with SMTP id 192mr2690830qkj.358.1571943019445; Thu, 24 Oct 2019 11:50:19 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::72b X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15830 Archived-At: Compile it yourself! Just look at the logic in srfi-151.sld and see how it needs to be modified for Guile. Easy-peasy. It's a lot less work to port a SRFI implementation than to do things from scratch. On Thu, Oct 24, 2019 at 2:26 PM Zelphir Kaltstahl < zelphirkaltstahl@posteo.de> wrote: > Ah, but SRFI 151 is not implemented in my version of Guile: > > ~~~~~ > scheme@(guile-user)> (use-modules (srfi srfi-151)) > While compiling expression: > no code for module (srfi srfi-151) > scheme@(guile-user)> > ~~~~~ > > Guile version: 2.2.6 from Guix: > > ~~~~~ > guile (GNU Guile) 2.2.6 > Copyright (C) 2019 Free Software Foundation, Inc. > > License LGPLv3+: GNU LGPL 3 or later > . > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > ~~~~~ > > Are you suggesting, that I copy the code for SRFI 151 from somewhere and > put it into my project? > > Regards, > > Zelphir > On 10/24/19 7:02 PM, John Cowan wrote: > > For bitwise integers, I recommend SRFI 151. If you use your > implementation to provide the seven core functions bitwise-not, > bitwise-and, bitwise-ior, bitwise-xor, arithmetic-shift, integer-length, > and bit-count, all of which have definitions in bitwise-core.scm that are > very slow, then you'll have a package that can do pretty much what all the > bitwise SRFIs provide and more with acceptable performance. > > There is a conversion table at the end of the SRFI between the names used > by other SRFIs and the names used by SRFI 151; they are as close to SRFI 33 > and SRFI 60 as practical. It is part of the Tangerine Edition of > R7RS-large. > > On Thu, Oct 24, 2019 at 12:43 PM Nala Ginrut wrote: > >> Personally, I prefer srfi. But sometimes I mix with RnRS. >> I think it's better to avoid Guile specific things, however, Guile >> provides >> many good things that the standard doesn't have. >> >> On Thu, Oct 24, 2019 at 11:56 PM Zelphir Kaltstahl < >> zelphirkaltstahl@posteo.de> wrote: >> >> > Hello Guile Users! >> > >> > I have a question regarding usage of SRFIs in Guile code. >> > >> > Sometimes there are core functions, which are also available from an >> > SRFI implementation. One example I am currently dealing with are bitwise >> > operations for integer numbers. There is SRFI 60 and there are the core >> > functions like logand, logior and so on. >> > >> > Usually I tend to think, that using the SRFI implementation in such >> > situation is better, as it is an implementation of a common interface, >> > which other Schemes might also have implemented. Using that makes code >> > more portable to other Schemes. However, I want to be sure, that this is >> > a good way of thinking about it. Are there ever arguments against using >> > an SRFI implementation, when an SRFI implementation provides what I >> need? >> > >> > Another example are structs. I usually use SRFI 9 to make some structs, >> > instead of the core record or struct type. >> > >> > What do you think? >> > >> > Best regards, >> > >> > Zelphir >> > >> > >> > >> >