Skip to content

Instantly share code, notes, and snippets.

@okram
Last active October 15, 2020 09:40
Show Gist options
  • Save okram/ec1fd7d07f375a4c2a5a61fae34a1f77 to your computer and use it in GitHub Desktop.
Save okram/ec1fd7d07f375a4c2a5a61fae34a1f77 to your computer and use it in GitHub Desktop.
mmlang> :[model,pg_2] // load property graph demo model #2
==>_
mmlang> 4 ~~> int // what is the path from 4 to int? simply int.
==>((int))<=4[walk,int]
mmlang> 4 ~~> str // what is the path from 4 to str? this is none. no ".toString()"
==>( )
mmlang> :[model,pg_2][define,str<=int] // lets define ".toString()"
==>_[define,str<=int]
mmlang> 4 ~~> str // what is the path from 4 to str? int then str
==>((int;str))<=4[walk,str]
mmlang> 4 ~~> vertex // what is the path from 4 to vertex? split the 4 across a vertex record
==>((int;[split,('id'->int)];vertex))<=4[walk,vertex]
// new lines (\n) below I added manually to ease readability.
mmlang> (5;6) ~~> (vertex;vertex) // what about a pair of ints to a pair of vertices?
==>(((int;int);(vertex;vertex);
[combine,(vertex<=int[split,('id'->int)];vertex<=int[split,('id'->int)])];(vertex;vertex)))
<=(5;6)[walk,(vertex;vertex)]
mmlang> (5;6) ~~> edge // how about a pair of ints to an edge (which is a type referent to a rec product -- ismorphism of products)
==>(((int;int);(vertex;vertex);
[combine,(vertex<=int[split,('id'->int)];vertex<=int[split,('id'->int)])];
[split,('outV'->vertex<=(vertex;vertex)[get,0,_],'inV'->vertex<=(vertex;vertex)[get,1,_])];edge))
<=(5;6)[walk,edge]
mmlang>
@okram
Copy link
Author

okram commented Oct 15, 2020

Note that ;-lsts are serial composition polys. In this way, the algebra of paths is equivalent to the multiplicative monoid of stream ring theory.

@okram
Copy link
Author

okram commented Oct 15, 2020

When I wake up, I'll demo the abelian group which are ,-lst polys … They represent branches in a path. Together, a poly structure of the form ((;;),(;;),(;;)) monoid ring — or, when only containing types (no instructions), its a classic polynomial w/ coefficients.

https://www.mm-adt.org/vm/#_poly_controls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment