Temporal

From Esolang
Jump to navigation Jump to search

Temporal is a stack-based time-travel language by User:Plokmijnuhby (we don't appear to have one yet, and it's not like they're hard to design). It is hoped that it will be easier to demonstrate the computability of this language than other time-travelling languages like TwoDucks and TRAVEL 33.

When I refer to "a timestep", I don't mean any actual unit of time, I'm pretending that each instruction takes one timestep to run; this language cannot accurately tell the time, due to the time distortions caused by the wormholes used. In the event of a paradox, the distortions will become so great the code will run forever, so please try not to do that.

You'll also notice I haven't included usable input - many languages don't have this anyway, and it's just a bit confusing with time travel.

Syntax

The syntax for this language is the same as Underload, but with two additional commands. The language is stack based, like Underload.

Command Meaning
~ Swap the top two elements of the stack.
: Duplicate the top element of the stack.
! Discard the top element of the stack.
* Concatenate the top two elements of the stack.
(x) Push everything between the brackets onto the stack.
a Enclose the top element in brackets.
^ Pop the stack and add the popped element to the next part of the code (and execute it).
S Pop the stack and output the popped element.
< The "shove" instruction, not included in Underload. Pop two elements, where the first is an element with n elements (so (a(bc)d) has 3 elements) and push the second popped element on top of the stack n timesteps ago.
> The "grab" instruction, not included in Underload. Pop one element with n elements (as described above). Pop an element from the stack n timesteps in the future, then in the present push that element onto the stack. Kind of the inverse of <.

Examples

Bootstrap

(12)<

The program always tries to avoid runtime errors, so this does not produce an error. The element is shoved from the end of the < two steps back to just before the (12) command starts. We have no idea what the element is, we just know we can shove it.

Paradox

(1)~()~(123456)*<

If the program shoves to 6 timesteps ago, the shoved element appears just after the (1) is pushed and is then swapped so the (1) is on top. A () is pushed - it will become the value to be shoved - and then the (1) has 6 elements appended to it. The () is then shoved back 7 timesteps - but wait, it was only supposed to go back 6 timesteps! If it goes back more than 6, it will appear before the (1) is pushed, so it will end up on top instead. Then when (123456) is appended to it, it will still only have 6 elements, leading to it being sent back only 6 timesteps. In other words, if it is sent back 6 steps, it is sent back 7 steps and vice versa.