Note: This page contains a great deal of Science Fiction. YMMV!


As discussed in the Protocols summary, Elixir defines assorted protocols (e.g., Access, Collectable, Enumerable, Inspect, List.Chars, Range.Iterable, String.Chars). The PuffyData module needs to support these protocols, as appropriate.

It would also be nice to support data structures from other languages (e.g., Clojure's ArrayMap, Sorted-Map, and Vector). To do this, PuffyData may need to define and implement additional protocols. However, some data structures will involve tricky problems.

For example, Clojure's model of Persistent Data Structures and Managed References differs so substantially from Elixir's Actor model that some of Clojure's data structures may never play nicely with Elixir. But we won't know until we give it a try:

As a rule, software systems do not work well until they have been used,
and have failed repeatedly, in real applications. – Dave Parnas


Per Clojure's Rich Hickey

Rich Hickey's implementation of persistent data structures (used in Clojure, ClojureScript, Scala, etc.) is based on bit-partitioned hash tries and structural sharing (implemented by means of path copying):

As Adopted and Adapted

Puffy Data adopts this approach, by and large, but adds a few tweaks:

  • Each version of each data structure is stored in a separate bit string,
    encoded as a binary large object (blob).

  • References to puffy data structures are encoded (in user code)
    as tuples, e.g.: { type_key, meta_map, data_blob }

Data Storage

The current implementation approach relies on Erlang's Binary Heap, which automagically stores all binaries that are larger than 64 bytes, along with supplemental storage in Erlang Term Storage (ETS). For details, see the Data_Storage and Transactor pages.

This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r11 - 04 Apr 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email