tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marko Rodriguez <okramma...@gmail.com>
Subject I believe mm-ADT needs the concept of a sequence.
Date Wed, 05 Jun 2019 22:59:57 GMT

I think that mm-ADT has new data type.

	sequence: zero or more objects.

…where the two collections are a type of sequence:

	list: an integer-based index of a sequence.
	map: an object-based index of a sequence.

Why does a sequence exist? It exists because we don’t have a name for this anonymous type:


The above type/pattern is one of two things:

	1. A multi-referent reference.
	2. A sequence.

Given that references are implicitly dereferenced, I don’t think we should mix references
in our patterns as references ultimately are the thing they are referencing. 

As such @object* is a “sequence.” Its not a list, because a list is typed as:


And what is that really saying? — its saying that a list is container of a sequence. What
is the nature of that container? integer-based indexing.

A sequence is like a “structureless list.” Why? Because these are the only mutation instructions
that work on it:

	1. [append,@object]
	2. [delete,@object]

You can’t [insert] because there is no way to say where to insert — there are no indices.

Finally, if “sequence" is the name of @object*, then I think a reference can be redefined
to only allow one-to-one linking.


This doesn’t return a reference to zero or more person objects. No, it returns a reference
to a single sequence. Likewise, with respects to indexing:

-> [has,name,eq,$x.@string] => &person*

We have a reference to zero or more persons — a sequence of persons.

Finally, this also means that the following types are subtypes of sequence as they are all
subtypes of @object*.


With respect to the last type, this means that every denoted thing is a sequence. 


That is a sequence of one element that is a string — i.e. @string. Or, more specifically,

This then means that [append] and [delete] can be applied everywhere that supports 0 or >1

[constant,’hello’]   // ‘hello'
[append,42]          // ‘hello’ 42
[append,’marko’]     // ‘hello’ 42 ‘marko'
[delete,’hello’]     // 42 ‘marko'

What scares me is that we don’t have a way of representing instances of a multi-element
sequence in our language. The below is ambiguous with sequences of containers. 

[name:marko, projects:tinkerpop,lop,gremlin]

Maybe we do:

[name:marko, projects:<tinkerpop,lop,gremlin>]



…or perhaps:

[name:marko, projects:(tinkerpop,lop,gremlin)]

Its a pattern match group.

Finally, realize that this gets at a problem that I can’t seem to solve without the concept
of a “sequence” (a containerless collection). And if you say that “sequences” are
just lists, then bytecode will be a nasty tangle of [unfold] instructions — and overly complex
reference graphs.


http://rredux.com <http://rredux.com/>

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message