Crazy Layered Memory

From Esolang
Jump to navigation Jump to search

Crazy Layered Memory (a.k.a. clm) is a data structure that uses layers and cells to store data.


Each layer contains any number of layers and cells, as well as one index-cell and a active-cell.

The index-cell is stored at index -1 of its layer and contains the index that is currently accessed at this layer.
The active-cell is stored at index -2 of its layer and stores, whether this layer is the active layer (if not, functions affect the layer below this one)


are located inside of layers and contain the actual data


Function Description
insertLayer inserts a new layer after the current element
insertCell inserts a new cell after the current element
delete deletes the element referenced by the index-cell
next changes the index-cell by 1 (if index is greater than or equal to the length of the layer it loops around to -1)
previous changes the index-cell by -1 (if index is less than -1 it loops around to the last elemnt of the layer)
down if the current element is a layer, enter that layer
up exits current layer if possible
length returns the length of the current layer (excluding index- and marker-cell)

Usage in esolangs

Currently, clm is only used by one esolang, clml, it is previously categorized in Category:Clm-based, but that category was deleted because it only contains one esolang.