Use the left/right arrow keys to navigate.

Bandicoot

Set-based programming language

A list of objects with tags:

1: foo, bar
2: foo
3: baz

As tuples:

(1, foo)
(1, bar)
(2, foo)
(3, baz)

A relation consists of a heading and a body.

A heading is a set of attributes.

{id, tag}

A body is a set of tuples.

{(1, foo), (1, bar), (2, foo), (3, baz)}

Table heading.

id | tag <
 1 | foo
 1 | bar
 2 | foo
 3 | baz

Table body.

id | tag
 1 | foo <
 1 | bar <
 2 | foo <
 3 | baz <

Relational operations

Project

id | tag                tag
 1 | foo  project(tag)  foo
 1 | bar                bar
 2 | foo                baz
 3 | baz

Rename

id | tag                    foo | tag
 1 | foo  rename(foo = id)    1 | foo
 1 | bar                      1 | bar
 2 | foo                      2 | foo
 3 | baz                      3 | baz

Extend

 id | tag                     id | tag | stars
  1 | foo  extend(stars = 5)   1 | foo | 5
  1 | bar                      1 | bar | 5
  2 | foo                      2 | foo | 5
  3 | baz                      3 | baz | 5

Select

 id | tag                  id | tag
  1 | foo  select(id < 3)   1 | foo
  1 | bar                   1 | bar
  2 | foo                   2 | foo
  3 | baz

Natural join

 id | tag     id     id | tag
  1 | foo  *   1  =   1 | foo
  1 | bar      3      1 | bar
  2 | foo             3 | baz
  3 | baz

Minus

 id | tag     tag     id | tag
  1 | foo  -  foo  =   1 | bar
  1 | bar              3 | baz
  2 | foo
  3 | baz

Minus

 id | tag     id | tag     id | tag
  1 | foo  -   1 | bar  =   1 | foo
  1 | bar                   2 | foo
  2 | foo                   3 | baz
  3 | baz

Union

 id | tag     id | tag     id | tag
  1 | foo  +   2 | baz  =   1 | foo
  1 | bar      3 | baz      1 | bar
  2 | foo                   2 | foo
  3 | baz                   2 | baz
                            3 | baz

A relation defined in Bandicoot.

rel Tagging {
  id:  int,
  tag: string,
}

rel Object {
  id:  int,
}

Global variables are persisted to disk.

taggings: Tagging;

Functions are exposed via HTTP.

Clearing the database is a minus operation.

fn clear() {
  taggings -= taggings;
}

Removing all taggings for certain objects is a minus operation.

fn del(o: Object) {
  taggings = taggings - o;
}

Adding tags combines project, minus and union operations.

fn add(t: Tagging) {
  taggings = taggings - t project(id) + t;
}

Retrieving related objects combines minus, project and natural join operations.

fn related(o: Object): Object {
  return (taggings - o) * ((taggings * o) project(tag));
}

More information about Bandicoot: http://bandilab.org/