Dimensions is an esoteric programming language invented by Tom Price-Nicholson in 2014. It was inspired by a class of esolangs called fungeoids (although it may not be a fungeoid) and, of all things, string theory. Dimensions behaves as if it has an array of cells where data can be stored and a pointer that can move through the array. The catch is this: the array has 52 dimensions. Each dimension is infinite. Dimensions was designed to appeal to string theorists, sci-fi fans, and anybody else who likes the idea of multiple dimensions.
- 1 Array and pointer
- 2 Specifying dimensions
- 3 Syntax
- 4 Example programs
- 5 Disclaimer
- 6 See also
Array and pointer
The array in Dimensions has 52 dimensions. Each one is named with a letter, with a-z being the first 26 dimensions and A-Z being the second 26. The pointer starts at the origin and all of the cells are initially zero.
You can choose which dimension or dimensions the current instruction acts in (if the instruction is dimension specific, such as moving the pointer) by typing in the letters of the dimensions that you want, e.g. AbCdXQzbF. You can also choose a range of dimensions, e.g. A-Q chooses every dimension from A to Q inclusive.
Each instruction is enclosed in a pair of brackets to make it clear where one instruction ends and another begins. For example, (XCdfG>b<)(+) is a pair of instructions. A, B, C, D, E and F are used as example dimensions in the following explanations.
Moving the pointer
The pointer can be moved in two ways: either by motion (e.g. move one space forward in dimension A) or by velocity (e.g. move one space forward after every instruction in dimension A).
The instruction for motion is as follows: (ABC>DEF<). The pointer will move one space forward in the dimensions followed by a > and one space backwards in the dimensions followed by a <. The example means move one space forwards in A, B and C, and one space backwards in D, E and F. Both chevrons must be used in the instruction, even if only one is needed, so (A><) and (>B<) are valid, but (C>) and (D<) are not.
The pointer can be imparted with a velocity. The pointer can only have one of three velocities in each dimension: forwards one space after each instruction (forwards velocity), backwards one space after each instruction (backwards velocity), or zero. The velocity is described as belonging to the dimension that it is in, rather than belonging to the pointer. When a velocity instruction is given, it changes the velocity of the dimensions named in the instruction to the velocities given in the instruction, regardless of their original velocities. If a dimension is not named in the instruction, its velocity is unchanged. The instruction is as follows: (AB#CD~EF@). The dimensions followed by a # will have their velocities changed to forwards velocity, the dimensions followed by a ~ will have their velocities changed to backwards velocity, and the dimensions followed by a @ will have their velocities changed to zero. The velocities of dimensions not in the instruction will remain the same as they were before the instruction. #, ~ and @ must all be used, so (A#~@), (#B~@) and (#~C@) are valid, but (D#), (E~) and (F@) are not.
Increase and decreasing the value of a cell
In the following instructions, any number can be used as required e.g. 1279, but "number" will be used in place of a number.
("number"+) will increase the value of the cell by "number".
("number"-) will decrease the value of a cell by "number".
Storing a velocity in a cell
You can store a velocity instruction in a cell. (&"velocity") sets the value of the cell to zero, then stores the velocity instruction "velocity" in the cell. Velocity instructions follow the rules described above.
You can input and output characters to and from cells.
(%) asks for an input. The current data stored in the cell is wiped, then the ASCII value of the first byte of input is stored in the cell.
There are two forms of output: if the cell has a value and if the cell has a velocity instruction.
If the cell has a value
(£) reads the value of the cell and outputs it as a number. ($) reads the value of the cell and outputs the corresponding ASCII value.
If the cell has a velocity
Both (£) and ($) implement the velocity instruction in the manner described above.
([) If the cell under the pointer contains no velocity instruction and a value of zero, jump forward to the instruction immediately after the matching (]). Otherwise, continue as normal.
(]) Jump back the most matching ([) instruction.
(/) does nothing. This usually used when you want the pointer to move under velocity but don't want to affect the cells the pointer is moving through.
If anybody comes up with any example programs, feel free to post them in this section.
This program prints "Hello World!" on the screen.
This program causes the pointer to shuttle back and forth between two cells forever.
Dimensions may seem needlessly complicated, but I never said it was designed to be easy. If you want to complain about how difficult it is, check out Malbolge to see how hard esolangs can get.