Graph Programming (2020)
hyro.ai
hyro.ai
Optionally, ports may assert a type allowing only like-type edges to be valid. Ports may also assert a direction requiring outgoing to connect only to incoming.
A nice feature of this concept (as also described in the article) is that a composition of a number of nodes can be recast to a single node which asserts the ports that have as yet not been connected.
The use of abstract concept like currying, recursion, map reduce is to have vocabulary express our thought IMO. Turning into graph is like coding imperatively - hard to grasp from quick glance. Code is more frequently read than written
f(a(), b())
you generally can't do the reverse. Not directly. Best you can do it: foo = f()
a(foo)
b(foo)
where you create a runtime indirection, or - in a language with reader macros, like Common Lisp: (a #1=(f) #1#)
where #1= lets you reference an AST node, and #1# lets you backlink to it. Unfortunately, that code will cause (f) to be called twice.The article is effectively exploring a way to combine these two methods - to have the code denote a DAG directly (or even cheat a little and denote a graph with cycles), where the runtime representation is also a graph, and not a tree.
Myself, I'm strongly hoping there will be more work done in that direction, because being forced to talk in trees is very limiting. Some problems would be much easier to express as DAGs (or even cyclic graphs), and would even be easier to read them as such.
I worry that what's keeping us working with trees is the nature of plaintext itself. I haven't proven it, or seen it proven, but I strongly suspect that there is no minimal, direct representation of a DAG possible in plaintext - you can't move past a tree without assigning labels for backreferences.
IIRC, function composition with multiple return values is sufficient to transform to IF1's 'function with named ports' representation.
> https://github.com/hyroai/computation-graph implements the first graph-programming framework, in python
Is this claiming to be the first such programming framework to be unveiled for Python, or the first one ever that just happens to b in Python? The comma usually would be chosen and placed to indicate the latter. But we’ve been doing this for many years under different guises.
Thinking about trees and DAGs, and having converted trees to DAGs in translators via pattern-matching: Functional languages like Haskell with let-forms allow graphs to be constructed, I believe. The let provides the definition of nodes with multiple out-edges.