[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Functional datatypes in Guile
From: |
Linus Björnstam |
Subject: |
Re: Functional datatypes in Guile |
Date: |
Sun, 05 Mar 2023 13:58:48 +0100 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-183-gbf7d00f500-fm-20230220.001-gbf7d00f5 |
On Sat, 4 Mar 2023, at 17:38, pukkamustard wrote:
> Hi Dave,
>
> 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?
This is to make sure that transient-fectors/flashes (in-place mutation with
some copying going on to not break the other copies of the sector being
mutated) thread safe. They should only be mutated by the current thread.
It is a nice trade off , since you get a lot less copying if you mutate many
values in the same leaf. This is especially good when building a fector meaning
you can fill every tail by just using vector-set! without copying. Let's just
say that it becomes a lot faster:)
/Linus