Tue Aug 29 04:04:35 EDT 2017
Building differential components
Let's stick to the "nested dictionaries" representation in Erlang,
which seems simple enough because it has only one kind of constructor
(the Erlang map).
When order is imposed on the keys, out comes a structure that is very
similar to the nested structure of xhtml / xml. Additionally the keys
give a way to identify elements for insertion, deletion.
Essential operations are:
- remove subtree
- insert leaf element in subtree
- create new subtree (done as iterated construction from inserts)
How to specify the constructors such that they are easily translated
Note that this is a fairly strong limitation: model "list structure"
needs to correspond to XHTML "list structure". React is much more
But then again, React can probably be modeled by adding a second
compilation step that brings it closer to a DOM-like structure, e.g. a
second presentation model that brings a first transformation into the
xhtml-like representation of keyed nested lists.
So the assumption is: it is straightforward to create constructors for
leaf nodes. This is the only "real work" left to do. Everything else
is composed of generic operations.
In the Erlang model, a leaf node is represented by a list or tuple.