Arbitrary memory emulation

From Esolang
Jump to navigation Jump to search

Arbitrary memory emulation is a form of memory which, given a value that can be infinite in size without precision loss, allows for arbitrary memory in the event that such is not possible normally. AME can be used to emulate data structures which hold values sequentially, like stacks, tapes, or arrays.

Structure

Let be the value which will be used for AME. We define a positive integer greater than 1 which will denote the maximum size of each "cell" in memory, where a cell can have an integer value of . The index of each cell is denoted as . The relative position of each cell in memory, denoted by , is , where dividing by results in the cell's value in memory, and multiplying any value by results in its relative value. Each cell is times higher than the previous one.

For any given memory structure with cells , is equivalent to .

Operations

Operation Equation


Note that this algorithm is unreliable if stores any trailing zeroes. It is more reliable to manually track this value by incrementing or decrementing as values are added or removed.

Turing-completeness

A typical requirement for Turing-completeness is that the language has access to unbounded memory, regardless of the size of each cell. AME "flips" this case, where values of infinite size can be used for computational power, regardless of how many memory addresses there actually are. However, this requires that the language is able to handle values of infinite size without precision loss, and the language has the necessary space in order to compute and thereafter process and transform the memory.

Usage