Go to file
Brian Picciano c4dd673bf4 Refactor Graph internals to deduplicate OpenEdges
This change required OpenEdges to be passed around as pointers, which in
turn required me to audit how value copying is being done everywhere and
simplify it in a few places. I think I covered all the bases.

The new internals of Graph allow the graph's actual structure to be
reflected within the graph itself. For example, if the OpenEdges of two
ValueIns are equivalent then the same OpenEdge pointer is shared for the
two internally. This applies recursively, so if two OpenEdge tuples
share an inner OpenEdge, they will share the same pointer.

This change is a preliminary requirement for creating a graph mapping
operation. Without OpenEdge deduplication the map operation would end up
operating on the same OpenEdge multiple times, which would be incorrect.
2021-12-29 13:57:14 -07:00
gg Refactor Graph internals to deduplicate OpenEdges 2021-12-29 13:57:14 -07:00
graph Refactor Graph internals to deduplicate OpenEdges 2021-12-29 13:57:14 -07:00
sandbox rename Junction to Tuple, update syntax, rename Null to ZeroGraph 2021-08-26 21:26:24 -06:00
vm Refactor Graph internals to deduplicate OpenEdges 2021-12-29 13:57:14 -07:00
.gitignore gitignore 2016-08-07 09:06:36 -06:00
default.nix Make graph generic 2021-12-29 12:32:53 -07:00
go.mod Make graph generic 2021-12-29 12:32:53 -07:00
go.sum make into a module 2021-08-26 21:27:47 -06:00
README.md Make graph generic 2021-12-29 12:32:53 -07:00

Ginger

Fibonacci function in ginger:

fib = {
    decr = { out = add < (in; -1;); };

    out = {
        n = 0 < in;
        a = 1 < in;
        b = 2 < in;

        out < if < (
            zero? < n;
            a;
            recur < (decr < n; b; add < (a;b;); );
        );

    } < (in; 0; 1;);
};

Usage of the function to generate the 6th fibonnaci number:

fib < 5;

Development

Current efforts on ginger are focused on a golang-based virtual machine, which will then be used to bootstrap the language. go >=1.18 is required for this vm.

If you are on a linux-amd64 machine with nix installed, you can run:

nix-shell -A shell

from the repo root and you will be dropped into a shell with all dependencies (including the correct go version) in your PATH, ready to use. This could probably be expanded to other OSs/architectures easily, if you care to do so please check out the default.nix file and submit a PR!