View mqtt.c
This file contains 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
static JsonObject toJson(const byte *payload, const uint32_t length) { | |
char *json = (char *)malloc(length); | |
memcpy(json, payload, length); | |
if (json[0] == NULL) { | |
json = json + 2; | |
} | |
json[length - 1] = NULL; | |
StaticJsonDocument<256> doc; | |
DeserializationError error = deserializeJson(doc, json); | |
if (error) { |
View stuff.java
This file contains 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> 5 => int+2-<(nat;nat+10)=(vertex;vertex)=>edge | |
==>edge:('outV'->vertex:('id'->nat:7),'inV'->vertex:('id'->nat:17)) | |
mmlang> int => int+2-<(nat;nat+10)=(vertex;vertex)=>edge | |
==>edge<=int[plus,2] | |
[split,(nat{?}<=int[is,bool<=int[gt,0]];nat{?}<=int[is,bool<=int[gt,0]][plus,10])] | |
[combine,(vertex;vertex)] | |
[as,edge<=(vertex;vertex) | |
[split,('outV'->vertex<=(vertex;vertex)[get,0,_], | |
'inV'->vertex<=(vertex;vertex)[get,1,_])]] |
View mocoerce.java
This file contains 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> int => vertex | |
==>vertex<=int[is,bool<=int[gt,0]] | |
[coerce,vertex{?}<=nat{?}[split,('id'->nat)]] | |
mmlang> int => vertex => -<(_;_) | |
==>(vertex:('id'->nat);vertex:('id'->nat))<=int[is,bool<=int[gt,0]] | |
[coerce,vertex{?}<=nat{?}[split,('id'->nat)]] | |
[split,(vertex:('id'->nat);vertex:('id'->nat))] | |
mmlang> int => vertex => -<(_;_) => edge |
View branches.java
This file contains 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,2,3] // a stream of 3 ints | |
==>1 | |
==>2 | |
==>3 | |
mmlang> [1,2,3][id] // passing the stream through the [id] instruction (ring *) | |
==>1 | |
==>2 | |
==>3 | |
mmlang> [1,2,3][[id],[id]] // passing the stream across two branches with [id] instructions (ring +) | |
==>1{2} |
View objgraph2.java
This file contains 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
// all cascading coercion is completely determined within the obj graph and thus, realized as instructions. | |
mmlang> :[model,digraph] | |
==>_ | |
mmlang> int | |
==>int | |
mmlang> int => nat | |
==>nat<=int[is,bool<=int[gt,0]] | |
mmlang> int => nat => vertex | |
==>vertex<=int[is,bool<=int[gt,0]][split,('id'->nat)] | |
mmlang> int => nat => vertex -<(_;_) |
View =>-compilation.java
This file contains 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 => nat[plus,1] => vertex => -<(_;_) => edge | |
nat <=int[is>0][plus,1] | |
vertex <=int[is>0][plus,1][split,('id'->nat)] | |
(vertex;vertex) <=int[is>0][plus,1][split,('id'->nat)][split,(vertex;vertex)] | |
edge <=int[is>0][plus,1][split,('id'->nat)][split,(vertex;vertex)][combine,[split,('outV'->[get,0],'inV'->[get,1])]] |
View paths.java
This file contains 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] |
View gist:d4c06a947f66198039b4e858c59d9fbf
This file contains 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]])] |
View traversal.java
This file contains 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: |
View coerce.java
This file contains 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,_])], |
NewerOlder