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 stack.

The History data structure

Its behavior is very like the stack. There are 2 primary operations: UPDATE, and DELETE.

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

op meaning History
UPDATE X Update the current number as X, and put the previous "current number" into history. +X
DELETE X Remove every update until the X-th update. All of the updates after the X-th update(including the X-th update) is kept. -X

An example session of the verbose version of History

HISTORY:
COMMAND: UPDATE 1
HISTORY:
    @UPDATE #1 is 1
COMMAND: UPDATE 2
HISTORY:
    @UPDATE #2 is 2
    @UPDATE #1 is 1
COMMAND: DELETE 2
HISTORY:
    @UPDATE #1 is 2
COMMAND: BYE

Computational class

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