Kinds of containers
Ulrich Kuettler via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 21 10:42:59 PDT 2015
On Wednesday, 21 October 2015 at 11:05:12 UTC, Andrei
Alexandrescu wrote:
> I'm finally getting the cycles to get to thinking about Design
> by Introspection containers. First off, there are several
> general categories of containers. I think D should support all
> properly. One question is which we go for in the standard
> library.
>
> 1. Functional containers.
Very much in favor of functional (or persistent) containers.
Immutable. Value semantics.
This might take some getting used to, but if properly designed
these containers would be killer for D. A dream come true.
>
> These are immutable; once created, neither their topology nor
> their elements may be observably changed. Manipulating a
> container entails creating an entire new container, often based
> on an existing container (e.g. append takes a container and an
> element and creates a whole new container).
>
> Internally, functional containers take advantage of common
> substructure and immutability to share actual data. The classic
> resource for defining and implementing functional containers is
> http://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504.
>
An insanely beautiful example is clojure's PersistantVector.
AFAIK it made its way into Scala, too.
More information about the Digitalmars-d
mailing list