is based on algebraic data types (e.g. functional sum types, an immutable list is built as
list(a, cons)
). It also includes a larger menagerie of functional structures, all algebraic data types.
n
Nir
05/07/2021, 3:07 PM
The problem is that an immutable list like that is simply a linked list
Nir
05/07/2021, 3:10 PM
And tends to have really poor performance characteristics, e.g. does not provide proper random access which is a rather key part of the List API. What you typically see nowadays for a general purpose immutable list are trees of sorts that store mini arrays, and have branching factors of 32, something like that.
Nir
05/07/2021, 3:10 PM
Immutable data structure implementations in general tend to get pretty complicated in practice because it tends to be very difficult to balance all the desirable performance characteristics
a
Asq
05/07/2021, 3:13 PM
You described an immutable "array" in Scala 🙂. I'm well aware of that aspect of functional data structures. That is the reason I wondered if anyone is interested.
n
Nir
05/07/2021, 3:14 PM
Indeed 🙂 I think the kotlinx implementation is based on that (though I could be wrong)
s
Shawn
05/07/2021, 3:14 PM
see also #C1JMF6UDV, #C5UPMM0A0
a
Asq
05/07/2021, 3:20 PM
Thanks, I will move to #C1JMF6UDV, it's probably a better home for this special interest subject.