History (programming language)

From Esolang
Jump to: navigation, search

History is a joke programming language that depends on the History data structure, an esoteric data structure inspired by the queue that cannot delete anything.

The History data structure

Its behavior is very simplar to the queue. There are 2 primary operations: UPDATE, and INSERT.

The following table explains them, and shows how to implement them in History.

op meaning
UPDATE X Update the current number as X, and put the previous "current number" into history.
INSERT X Insert the backmost item to the index between index X and index X+1 without deleting the backmost item.
TOP X Insert the top item to the index between X and X+1 without deleting the item.
ONSERT X Put position X onto the top of the history without deleting the item.

An example session of History

HISTORY:
COMMAND: UPDATE 1
HISTORY:
    @UPDATE #1 is 1
COMMAND: UPDATE 2
HISTORY:
    @UPDATE #2 is 2
    @UPDATE #1 is 1
COMMAND: INSERT 2
HISTORY:
    @UPDATE #3 is 1
    @UPDATE #2 is 2
    @UPDATE #1 is 1
COMMAND: BYE

Computational class

It is not Turing-complete, of course. (It cannot execute an infinite loop.)