Table

From Esolang
Jump to: navigation, search

The Table programming language is an esoteric, declarative table-oriented programming language by User:Rdococ in which everything is an associative array, or dictionary, or table, depending on what terminology you want to use.

Structure

Table supports lazy evaluation, and defining tables recursively in terms of itself or other tables is allowed.

The syntax is pretty simple. Firstly, everything is a table, so this means the program is one too. This means that you must use the same table syntax for defining variables that would otherwise be outside a table. Secondly, I've provided examples at the bottom of the page, so you might want to look there for a general idea.

Comments are prefixed with the # symbol, and end at a newline or another hash symbol - whichever comes first.

To import a library, you type the library file name on its own, without defining it:

thisIsALibraryTable,
andThisIsNot: [derp]

Computational Class

The computational class of the Table programming language is unclear. However, you can simulate a finite state automaton in it.

Examples

Attempting to write a Hello World program in Table, I think, is a misleading exercise. Instead, here, we will look at writing small libraries for stuff like logic.

Boolean Logic

true: [[]: []],
false: [],
and: [true: [true: true, false: false], false: [true: false, false: false]],
or: [true: [true: true, false: true], false: [true: true, false: false]],
xor: [true: [true: false, false: true], false: [true: true, false: false]],
not: [true: false, false: true]

Arithmetic

Umm... This probably won't work in Table... These use the successor (S(a)=a+1) and predecessor (P(a)=a-1) functions. They borrow from the Peano Axioms. (To Be Implemented)