text_delta v1.0.1 TextDelta.Delta.Composition

The composition of two non-concurrent operations into a single operation.

The operations are composed in such a way that the resulting operation has the same effect on document state as applying one operation and then the other:

S ○ compose(Oa, Ob) = S ○ Oa ○ Ob

In more simple terms, composition allows you to take many operations and transform them into one of equal effect. When used together with Operational Transformation that allows to reduce system overhead when tracking non-synced changes.



Composes two operations into a single equivalent operation


compose(delta_a, delta_b)

Composes two operations into a single equivalent operation.


iex> TextDelta.Delta.compose([%{insert: "Bar"}], [%{insert: "Foo"}])
[%{insert: "FooBar"}]