Charts Lambda

From PublicWiki
Jump to: navigation, search

Go back to Chart_research for some perspective.

Examples

Each node name is a free variable (which needs to be bound by the Chartrunner). Input and output are bound; output is the name of the function and input is the name of the argument. In other words:--

If I have a node defined as:

(x, y : f, g) d

This means that d is a piece of code that supplies two functions f(x, y) and g(x,y).

If I have the following definitions:

(x : h) dee
(x : f) [ (x : g) da
          (g : f) dee ]

Then the code in da defines g(x) and the code in dee defines h(x); in this case f(x)=h(g(x)).

The channels in and out are abstract functions; the realization of their node represents how they will actually be computed, and the associations between them. The functions are anonymous because channels have no name outside of their scope.

Recursion

A cycle or a circuit represents recursion. Our notation is not meant for this program, but try to imagine it (here, the contents of curly-braces represent return values, as simple functions of input values, in the order that outputs are listed in the definition of the line):

(x : fact) [ (x : cycle, work) {x, 1}
             (cycle, work : cycle, work) {cycle-1, work * cycle} ]

We need a contract that decides where to connect work on each iteration (to the second line, as shown, or right out to fact, not shown). If we have some sort of track-switching system (that is, one that can make slight changes to a chart, or switch flags on the chart) then that can monitor recursion. The initialization of work probably belongs in the contract, even though I show it here.

The solution to this is probably similar to the solution for loops in general.