From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stuart Hungerford Newsgroups: gmane.lisp.guile.user Subject: Re: Idiomatic Guile for semigroup/monoid/group? Date: Mon, 3 Jan 2022 10:46:22 +1100 Message-ID: References: <7af1fd7e8bf7b0c84cdda3a431412bac31b45f18.camel@telenet.be> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11511"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: Maxime Devos Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Jan 03 00:46:51 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 1n4AYt-0002nD-Cl for guile-user@m.gmane-mx.org; Mon, 03 Jan 2022 00:46:51 +0100 Original-Received: from localhost ([::1]:57932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4AYr-0007hZ-Fw for guile-user@m.gmane-mx.org; Sun, 02 Jan 2022 18:46:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:59524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4AYg-0007hN-14 for guile-user@gnu.org; Sun, 02 Jan 2022 18:46:38 -0500 Original-Received: from [2a00:1450:4864:20::12d] (port=41504 helo=mail-lf1-x12d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4AYe-00052Z-F2 for guile-user@gnu.org; Sun, 02 Jan 2022 18:46:37 -0500 Original-Received: by mail-lf1-x12d.google.com with SMTP id x7so71820837lfu.8 for ; Sun, 02 Jan 2022 15:46:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DlZZ3Y/26a1JGSGIc02+fIGGrrw45IRwg4vAiCNDh7s=; b=HBHXEmYqbDwy3GiEh/NobyzvR60W0jBTLWjdUR65UAHqZoJHfoul2A6QLUdbNx8iTN 6LyOkJbV33x+ANVLtAID/N1w4FwgfE8mLJZ6sSiFaYQdIGFFHBODlA4C8AhvALvNHQ56 d6yYnl59oePPl2wewDdD3IEx2DRajJV+GoyI/5cCRjekWq+Pxl0NVGZASeR4DM/TofyS l33Fb5YrdbuPNfmlb4M5rmUph8C7bV6FFYRq67m39pe+5wdzvVilldO/O4e6x0Gx5vs7 Os6ceJSi2dTF28XA566SmM4F/47JqF+6A0WWsZ3c823aZUSkxVoeHGVMhFV85UZ+UZfo 0KRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DlZZ3Y/26a1JGSGIc02+fIGGrrw45IRwg4vAiCNDh7s=; b=ymypeUKS/5wb0rPDR2baZZWNNRYls9FfATNrJWuzfWxdVuz4g4aZ9qgKONdGCrERXf wkSjuaUyrRsOZBXuNcU2dltKdEObJuUbHhFNxxA+05Sqn8rQ/+xi1tzAAjpnb1+f60nx yDQIqCZUcpLecqbwjtNKAiQ/NU5JHELT9lJZUzmVlXiMx/aHZ92tm2lblIsKOhFbPt4I nQwu4gVsBPq67eOj4IK9DfqfZc5zeNcUlcbttc2MeQSoHr6YsoOKFY1ozOAo3CJKpptY +HxY32Pgf5Kf9yzWAcvUlTdepi/pb3oIX+44khZC/WKpnQlEGy69jwqOK1nViIMcBuri qcgQ== X-Gm-Message-State: AOAM530wKAQ8tEdsMnSRDncwy9pr/uDNmvdYuxoBTSIf+Z2sNsWpMOZ1 dqxuqIMpjXimLdQaxg/eaUnZgJqbaUzGDoug1w== X-Google-Smtp-Source: ABdhPJwr9vR8PW+2sjJ/2H7mgfzoggiGdu8w42UBXWKo2L7hKa3Rvuq4wBkWRqvf2kvPpfMIILKp0SKT4FpC20nkyxM= X-Received: by 2002:a05:6512:22ca:: with SMTP id g10mr38788356lfu.338.1641167193600; Sun, 02 Jan 2022 15:46:33 -0800 (PST) In-Reply-To: <7af1fd7e8bf7b0c84cdda3a431412bac31b45f18.camel@telenet.be> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::12d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::12d; envelope-from=stuart.hungerford@gmail.com; helo=mail-lf1-x12d.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) 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_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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.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:17945 Archived-At: On Sun, Jan 2, 2022 at 9:46 PM Maxime Devos wrote: > > In Haskell/Idris/Purescript/Swift/Rust I'd be looking to > > typeclasses/protocols or traits to model a semigroup, monoid or group. > > In OOP languages I'd be looking to some kind of abstract base class to > > model each structure. > > > > What would the idiomatic Guile forms be to work with these structures? > > Would it involve GOOPS or records? > > I wouldn't recommend using GOOPS methods, because a carrier set can > have many groups. > > E.g., on the rational numbers ( in GOOPS), both the > multiplication group and the addition group can be defined, but they > aren't isomorphic. (I'm ignoring 0 here) > > My suggestion is to do as Haskell does, but make type class instances > explicit. Thanks for that advice -- much appreciated. > Anyway, possibly things like this are already implemented in Theme-D > (not sure though): looking at the properties of Theme-D listed at > : That's very interesting. I'd been wondering if there was an extension for Guile that did what Typed Racket does for Racket or what Coalton does for Common Lisp. Just out of interest, are there other multimethod/ad-hoc polymorphism approaches for Guile? Thanks, Stu