From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip McGrath <philip@philipmcgrath.com> Newsgroups: gmane.lisp.guile.user Subject: Equality and hashing for new datatypes Date: Wed, 21 Jun 2023 18:25:29 -0400 Message-ID: <3759578.e9J7NaK4W3@bastet> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4107697.aeNJFYEL58"; micalg="pgp-sha512"; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20672"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user <guile-user@gnu.org> Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu Jun 22 00:27:26 2023 Return-path: <guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org> 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 <guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org>) id 1qC6IN-00050y-5S for guile-user@m.gmane-mx.org; Thu, 22 Jun 2023 00:27:24 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guile-user-bounces@gnu.org>) id 1qC6Hp-0002H2-9e; Wed, 21 Jun 2023 18:26:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <philip@philipmcgrath.com>) id 1qC6Gl-0002BJ-2d for guile-user@gnu.org; Wed, 21 Jun 2023 18:25:43 -0400 Original-Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <philip@philipmcgrath.com>) id 1qC6Gi-0005Yc-TB for guile-user@gnu.org; Wed, 21 Jun 2023 18:25:42 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 6D78B3200944 for <guile-user@gnu.org>; Wed, 21 Jun 2023 18:25:37 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 21 Jun 2023 18:25:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= philipmcgrath.com; h=cc:content-type:content-type:date:date:from :from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm2; t=1687386337; x=1687472737; bh=Zq UTS2Ckhf6DUoRKtoZncubRfJ62ToraQTvrhhReTYw=; b=NSbnqAA0lGRrxxBuKL +wXgTnUsRk37wLK2gQhAFRzxfVu+0m/adKeHMFTGmYf9BZmy4ABDXxTVMIwdqP/C vQgJmtsX+GrHOerRsdu5UKuQZSbIaEF836F4t5UnEmcK7xpIcvGS8XSyEnTJMyhK iOkNo6yndUaEliWDbr6+zLjEL87CFqsuQQEih1/ZCEL0HjZiQDoo+rO1R31kRNTS V7vCG5Lvpm2Qbqa9n63nG388g2yoRg9OAMpwXQ73RtjzoRTvLjlhfGoyQP6Z7PFh mO7f6mJAI3xdmGxKUYS2dSh9HdzJtKZeCLlFvwDta1lAnsPXe+/wqIOh6gohn7Pf 9QQQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1687386337; x=1687472737; bh=ZqUTS2Ckhf6DUoRKtoZncubRfJ62ToraQTv rhhReTYw=; b=WcBgUQJnln8jABUd/X0IOpguhX5ga3jDyvtGquOuWWQvw/Welyr +Qf2lQFikMtu+LcfZbHUVW7uLSvKfX24NgVCnvOmi0OFKcGfC4tY1yXiOgDKpG9L NnTNujhwIX76UIMXvn1A0yuzwR/byCMHmeusrCBEkZXlZXPozvym36pKGsIIfBf5 kTNOtoo0xAwSXjqdMswff07nrYG2YaVH6c/kFuJ1h+udOw41cPdvLS8m1KBbXwX7 WsAaewKaSRw9SIayOqNFN0TG02QQ553QkoVci2p9LsJwjyVNtdsqxhMeLm7dvIbv BTcYIEeC9Qa8MNWLqO9l5LhqgwAt1E6Gw9A== X-ME-Sender: <xms:4HiTZG-bNdLcOKM57toJh4nMRJ3PxcILTl1Y2sgV3RLlX48P61q07Q> <xme:4HiTZGsEw35tHq--_93KClTPbohjjngZx4DCGVPgii6_-gTh5SY_42unCw-0ZKIT2 rvQB8sLC740o8YmKZI> X-ME-Received: <xmr:4HiTZMBbBQNDuvmNfsm2nKjsoXMfKtM7Wzv3CiydarG3118IdzuE1mGvfmLVTDY3kC5-8m6ARjME6b2oElaCCb9x470UPvuXHesJ1A> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeegtddgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhephffvufffkfggtgesghdtreertddtvdenucfhrhhomheprfhhihhlihhpucfo tgfirhgrthhhuceophhhihhlihhpsehphhhilhhiphhmtghgrhgrthhhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeevtdeuvdekudeiueeifefhtefgtdetleejueeuheegveehueet gffgieeigffhfeenucffohhmrghinhepghhnuhdrohhrghdprhgrtghkvghtqdhlrghngh drohhrghdpghhithhhuhgsrdhiohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgr mhepmhgrihhlfhhrohhmpehphhhilhhiphesphhhihhlihhpmhgtghhrrghthhdrtghomh X-ME-Proxy: <xmx:4HiTZOf8mXPYjypP9OoqQI4jjewHW_XBUheNmcLvq-U_nJrLlFVweg> <xmx:4HiTZLP8_0T1Lr0YohmbElMgpPWuhz2eAMBySIAEG7ePGP3mnFHE2Q> <xmx:4HiTZIkG8g3D2YQBYZxd9KifM-uEhVmV4-tnHn4gucEAJE8g81B9Yw> <xmx:4XiTZEpUtwzDp9DxkJ2Z4yeh_u8A7XEzPguW16P8-O_8HPso2ZwENg> Feedback-ID: i2b1146f3:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for <guile-user@gnu.org>; Wed, 21 Jun 2023 18:25:36 -0400 (EDT) Received-SPF: pass client-ip=64.147.123.25; envelope-from=philip@philipmcgrath.com; helo=wout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 21 Jun 2023 18:26:45 -0400 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions <guile-user.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guile-user>, <mailto:guile-user-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guile-user> List-Post: <mailto:guile-user@gnu.org> List-Help: <mailto:guile-user-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guile-user>, <mailto:guile-user-request@gnu.org?subject=subscribe> Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19057 Archived-At: <http://permalink.gmane.org/gmane.lisp.guile.user/19057> --nextPart4107697.aeNJFYEL58 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii"; protected-headers="v1" From: Philip McGrath <philip@philipmcgrath.com> To: guile-user <guile-user@gnu.org> Subject: Equality and hashing for new datatypes Date: Wed, 21 Jun 2023 18:25:29 -0400 Message-ID: <3759578.e9J7NaK4W3@bastet> MIME-Version: 1.0 Hi, What is the recommended way for a library to customize `equal?` and `equal?` -based hashing for new datatypes it defines? I know from [1] that `equal?` can be customized using GOOPS; however, some projects do not use GOOPS (e.g. [2]), so it would seem more friendly for a generic library to avoid it. Also, it is not clear if the same mechanism is even an option for customizing `equal-hash` to match `equal?`. I'm looking for something like Racket's `gen:equal+hash` [3] or Chez Scheme's `record-equal-procedure` and `record-hash-procedure` [4]. This came up while I was working on a portable version of the immutable hash-table implementations from Racket-on-Chez. -Philip [1]: https://www.gnu.org/software/guile/manual/html_node/GOOPS-Object-Miscellany.html [2]: https://lists.gnu.org/archive/html/info-gnu/2023-05/msg00005.html [3]: https://docs.racket-lang.org/reference/Equality.html#%28part._.Implementing_.Equality_for_.Custom_.Types%29 [4]: https://cisco.github.io/ChezScheme/csug9.5/objects.html#./objects:h14 --nextPart4107697.aeNJFYEL58 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE9GWrrNY3rqwUFVXPygNjjfo/HHoFAmSTeNkACgkQygNjjfo/ HHpvLg//VQs80ncOglsPK0H+3mQzkqe91DUqBqMQD7pXebscWfADUicfhctxBhUL vh8HgwlfTmjT0GKt4n0cZsSlmmI9V3/VXP0lwiAAm48coFCV9tPVhTc5hw5LkmNW 2I9t1XFdI6l9Ylw5hasXEQbLmVTvAHo7OkpBRrGeO15jfCpRA90UiuNlVoV6m4gD N1gNxyonHcRkNvm4T9YXO93w8HHBHHufqrMHOSbpDMEfl0uRoHyEyhpqLa3/0Eof TFt1V3I2toyuIyEtOe1HKNwLb9lbRu2Fw9aJ2LSQnr+fUDAO5XnPIumKaNEYDoR/ us4SAaaeXIkZ1oEE5+uVVRWU3D9gNkq08BtUahHJpOLkYT06bcJHPEkTk6GUuZtv zNygDyvl2mvaGdGOaaODdGmI4W/EdJIdQXuzJYJzWq9mGDvbMEJQdjmI9oEXY5yS BGdbrauHOTNkBOxNijA6xv9KBbifQ4ZOL3jVZVIKY+kqCdnBSZM/MyW0OwAU2hC8 lNUsxXhfV36K6xj4+OTU4KuaqS9vnr78nugiCY6vmQqkOegEUm558Zzgy2vsKANR 5T+mIyXQ+G5XTSl5wLLSYsPKa/D3GPOYKF/f8Sj8bpecW9FyDqpMZ5UouECdP3S3 oSoipR6rVFHQiyilNq3u/D2VZUxYGHpESTRPyoafQgd1nbKvGBs= =5kvS -----END PGP SIGNATURE----- --nextPart4107697.aeNJFYEL58--