linksplatform / Data.Doublets.Sequences

Platform.Data.Doublets.Sequences
The Unlicense
1 stars 1 forks source link

Add simplest possible left and right "stairs" converters for sequences. #30

Open Konard opened 1 year ago

Konard commented 1 year ago

image

image

Do not use ∅, pictures are wrong.

The correct source example is:

[1, 2, 3, 4]

Two ways to transform this into sequences

DescendingVariantConverter

This converter starts with a pair of two first elements and the goes "down the hill".

(((1 2) 3) 4)

Where (1 2) means, that it's ID used to make next pair and so on.

var doubletId = _links.GetOrCreate(sequence[0], sequence[1])

AscendingVariantConverter

In that case, converter starts from the end of list/sequence/array.

The complete result will be:

(1 (2 (3 4)))

Where (3 4) means, that it's ID used to make next pair and so on.

var doubletId = _links.GetOrCreate(sequence[i-1], sequence[i])

P.S.

Both sequences should be created at ./csharp/Platform.Data.Doublets.Sequences/Converters folder.