This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (int;int) => (nat;nat) | |
| ..yields: | |
| (nat;nat)<=(int;int)[combine,(nat<=int[is,bool<=int[gt,0]];nat<=int[is,bool<=int[gt,0]])] | |
| (nat;nat)<=(int;int)[combine,(nat<=int[is,bool<=int[gt,0]];nat<=int[is,bool<=int[gt,0]])] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Given [model,tp3], a graph traversal can be expressed as: | |
| vertex[get,outE][is,[get,label][eq,'knows']][get,inV] | |
| or w/ corresponding mmlang sugar syntax: | |
| vertex.outE[is.label=='knows'].inV | |
| or using auto-coercion over the following type definition: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (nat;attr);(nat;attr) => edge | |
| ((nat;attr);(nat;attr)), | |
| (vertex;vertex), | |
| [combine,(vertex<=(nat;attr)[split,('id'->nat<=(nat;attr)[get,0,_], | |
| 'attrs'->attr<=(nat;attr)[get,1,_])]; | |
| vertex<=(nat;attr)[split,('id'->nat<=(nat;attr)[get,0,_], | |
| 'attrs'->attr<=(nat;attr)[get,1,_])])], | |
| [split,('outV'->vertex<=(vertex;vertex)[get,0,_], | |
| 'inV'->vertex<=(vertex;vertex)[get,1,_])], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mmlang> :[model,mm][define,tree<=[?0|(int;tree;int)]] | |
| ==>_[define,tree<=_[_{?}<=_[is,bool<=_[a,0]]|(int;tree;int)]] | |
| mmlang> 0 => tree | |
| ==>tree:0 | |
| mmlang> 1 => tree | |
| language error: 1 is not a tree | |
| mmlang> (1;0;1) => tree | |
| ==>tree:(1;tree:0;1) | |
| mmlang> (1;(2;0;2);1) => tree | |
| ==>tree:(1;tree:(2;tree:0;2);1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mmlang> 1 | |
| ==>1 | |
| mmlang> 1-<(_;_) | |
| ==>(1;1) | |
| mmlang> 1-<(_;_)=(vertex;vertex) | |
| ==>(vertex:('id'->nat:1);vertex:('id'->nat:1)) | |
| mmlang> 1-<(_;_)=(vertex;vertex)=>edge | |
| ==>edge:('outV'->vertex:('id'->nat:1),'inV'->vertex:('id'->nat:1)) | |
| mmlang> | |
| mmlang> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List(edge<=(vertex;vertex)[split,('outV'->vertex<=(vertex;vertex)[get,0,_],'inV'->vertex<=(vertex;vertex)[get,1,_])]) | |
| List(cmplx:(real;real), <x>, cmplx<=cmplx:(real;real)<x>, [plus,cmplx<y>]{2}, [combine,(real;real){2}], cmplx:(real;real){2}) | |
| List(attr:('key'->_,'value'->_)) | |
| List(digraph#1105759305:('type'->([inst]->([inst]),attr->(attr:('key'->_,'value'->_),attr<=(str;_[id])[split,('key'->str<=(str;_[id])[get,0,_],'value'->_<=(str;_[id])[get,1,_])]),nat->(nat<=int[is,bool<=int[gt,0]]),cmplx:(real;real){2}->(cmplx{2}<=cmplx:(real;real)<x>[plus,cmplx<y>]{2}),bool->(bool),real->(real),str->(str),cmplx:(real;real)->(cmplx:(real;real)),rec->(rec),int->(int<=vertex[get,'id',_],int<=nat,int),edge->(edge:('outV'->vertex,'inV'->vertex),edge<=(vertex;vertex)[split,('outV'->vertex<=(vertex;vertex)[get,0,_],'inV'->vertex<=(vertex;vertex)[get,1,_])]),(_)->((_)<=(_[id]),(_)),(int)->((int)<=(int[neg][neg]),(int)<=(int[plus,0]),(int)<=(int[mult,1]),(int)),(_[1])->((_[1])<=(int[one]),(_[1])),(_[0])->((_[0])<=(int[zero]),(_[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"id":{"@type":"g:Int64","@value":0},"label":"type","properties":{"iso":[{"id":{"@type":"g:Int64","@value":3},"value":{"empty":true,"serial":false,"choice":false,"plus":false,"parallel":false}}],"obj":[{"id":{"@type":"g:Int64","@value":1},"value":{"empty":true,"serial":false,"choice":false,"plus":false,"parallel":false}}],"root":[{"id":{"@type":"g:Int64","@value":2},"value":true}]}} | |
| {"id":{"@type":"g:Int64","@value":64},"label":"type","inE":{"noop":[{"id":{"@type":"g:Int64","@value":68},"outV":{"@type":"g:Int64","@value":17},"properties":{"iso":{"empty":true,"serial":false,"choice":false,"plus":false,"parallel":false},"obj":{"empty":true,"serial":false,"choice":false,"plus":false,"parallel":false}}}]},"properties":{"iso":[{"id":{"@type":"g:Int64","@value":67},"value":{}}],"obj":[{"id":{"@type":"g:Int64","@value":65},"value":{}}],"root":[{"id":{"@type":"g:Int64","@value":66},"value":false}]}} | |
| {"id":{"@type":"g:Int64","@value":4},"label":"type","inE":{"split":[{"id":{"@type":"g:Int64","@value":16},"outV":{"@typ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mmlang> :[model,mm] // the base model (int,bool,real,str,lst,rec) | |
| ......> [define, | |
| ......> vertex<=rec, // a vertex is a sort of record | |
| ......> vertex<=int-<('id'->_), // a vertex can be constructed from an int | |
| ......> edge<=rec, // an edge is a sort of record | |
| ......> edge<=(vertex;vertex)-<('source'->.0,'target'->.1)] // an edge can be constructed from a vertex x vertex pair | |
| ==>_[define,vertex<=rec,vertex<=int[split,('id'->int)],edge<=rec,edge<=(vertex;vertex)[split,('source'->vertex<=(vertex;vertex)[get,0,_],'target'->vertex<=(vertex;vertex)[get,1,_])]] | |
| mmlang> 5 => vertex // morph 5 into a vertex | |
| ==>vertex:('id'->5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters