Skip to content

Instantly share code, notes, and snippets.

@okram
Last active November 19, 2019 10:09
Show Gist options
  • Save okram/21d2e5399ed6f7e01831e4eeec8daa65 to your computer and use it in GitHub Desktop.
Save okram/21d2e5399ed6f7e01831e4eeec8daa65 to your computer and use it in GitHub Desktop.
person[name:str~a,age:int~b]{*}~c =>[id]
| <=[=mongo][get,users]
| [is,[get,name][eq,a]]
| [map,[name:[get,'first'][plus,[get,'last']],
| age:2019-[get,'dob']]]
|
|-[-rule]([dedup]|[order]) => [id] | [count] => 100
|-[-path][put,'c',c]
|-[-loop][is,[get,i][a,repeat]][incr]
|-[-akka][is,[get,remote]][put,c,akka[ip:127.0.0.1,port:2222]]
|-[-sack][fold,real => [mult,b]]
|-[-ring]([mult,[one]] => [id] |
[plus,[zero]] => [id] |
[one] => person[name:'',age:0])
@okram
Copy link
Author

okram commented Nov 19, 2019

An object is structurally defined with ~x serving as global variables while an instance is being referenced.

=> ("map to" operator) there is no prescribed computation. In principle, => should be the remaining instructions in the program (pop off the stack, execute, and go).

<= ("map from" operator) there is a functor from the mongo model to the "social model". note that a structurally equivalent record is created in the mongo space and is what is ultimately returned by <=. Thus, there is a homomorphism between these two algebraically isolated environments.

|- ("monadic feature" operator) these are monadic state features (computational metadata). These will not be specified off datatypes, but off a monad-type perhaps.? these are the Traverser<S> features in TP3, but fully specified within mm-ADT.

[-rule]: a "first to fire" [inst] => [inst] listing (one particular rewrite engine. people can write their own). | is the binary operator for [choose]
[-path]: the current location of the traverser is stored in its path history. (only necessary if path data is being used by the query)
[-loop]: loop metadata associated with `[repeat]` (only necessary if the query uses loops)
[-akka]: serialization and network metadata necessary for distributed message passing with Akka. (only necessary if the processor is Akka)
[-sack]: a monoidal function that maintains a running sum of the ages of the people encountered.
[-ring]: like [-rule], instruction rewrites that respect the ring axioms.

[-] instructions represent features of the monad. ("object-oriented methods" programmable in mm-ADT)
[=] instructions represent exogenous model mappings. (embeddings/homomorphisms/projections/transformations/couplings/etc.)
[ ] instructions represent endogenous model mappings. (endomorphisms, i.e. moving through the current model.)

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