From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pukkamustard Newsgroups: gmane.lisp.guile.devel Subject: Re: Functional datatypes in Guile Date: Sat, 04 Mar 2023 16:38:48 +0000 Message-ID: <86356ko2h3.fsf@posteo.net> References: <2682583.mvXUDI8C0e@t480s> <86bklenq75.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22624"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jessica Tallon , guile-devel To: "Thompson, David" Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Mar 04 18:23:50 2023 Return-path: Envelope-to: guile-devel@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 1pYVbp-0005hD-Rr for guile-devel@m.gmane-mx.org; Sat, 04 Mar 2023 18:23:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYVbN-0007Vw-W0; Sat, 04 Mar 2023 12:23:22 -0500 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 ) id 1pYVbL-0007VY-Rc for guile-devel@gnu.org; Sat, 04 Mar 2023 12:23:20 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYVbK-00027h-4M for guile-devel@gnu.org; Sat, 04 Mar 2023 12:23:19 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id CA40A24021F for ; Sat, 4 Mar 2023 18:23:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1677950594; bh=3eah41pELhCTOA8ouGKTt6MqAqOu5vjPLxTnZWxptxQ=; h=From:To:Cc:Subject:Date:From; b=N9Pu4A2YYUKpaTUBXHl5d/L2Bdi65uYwZzeB1BHDUEdgd7TqgYj65qupiYUEjamBX aAjfDzRXZhgFl4ZXS4O8Yzq7KwcUtg8JKdTw5TXYgl0reDe7GkxWmYfXYPZtB1VHUs uqtLgYB+LYehDW+6077qvLI3e9EuiJusawNtA9X4BVNfRHJaBH57rbwV/UvX/EzcE4 Py1Y8kOJp4SB+uMCnPGwDnKEy8wygrxFAQqSPe8dXH5Mc2jqgcdRf/9yjLZEfym2To 9l0rwBRTDQDEWYF7Rkc0QhzgpGq4xST/7sVk/DN7DudFC+zMp1Jgap/B8ThletIRyc iePMyeKqY8CrQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PTWrd73fwz6ts6; Sat, 4 Mar 2023 18:23:13 +0100 (CET) In-reply-to: Received-SPF: pass client-ip=185.67.36.65; envelope-from=pukkamustard@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21771 Archived-At: Hi Dave, "Thompson, David" writes: [..] > Your Guile port of (srfi srfi-146 hash) looks really nice! A > functional hash is the most important data structure for our needs at > Spritely. Do you know if it's thread-safe (unlike vhashes)? Andy's > fash implementation uses atomic boxes, for example. I know very little about thread-safety, but the implementation is purely functional, and thus should be thread-safe. By purely functional, I mean that no state is mutated. Calls that update mapping return a new mapping. The old mapping remains unchanged. I imagine that if multiple threads want to access (and modify) the same mapping they would have to agree on the current mapping by keeping a reference to the current mapping in an atomic or similar. Makes me wonder, are Andy Wingo's fash/fector purely functional? Why do they need atomic boxes? Aren't they only necessary for destructive updates? > Also, what are your thoughts on read syntax? I find myself using > alists more often than I probably should because the syntax is > pleasant. (hashmap comparator 'foo 1 'bar 2) is... okay, but terse > syntax for the common case of a hash with literal keys would be nice. > For example, #hq((foo 1) (bar 2)) for a hash with keys compared with > eq? Scheme is kind of odd for not having hash literal syntax. No strong opinions on a read syntax. But I welcome anything that might increase adoption of purely functional data structures. I think they're cool! :) - pukkamustard