SetIncrementor

From Esolang
Jump to navigation Jump to search

SetIncrementor is an esolang derived from SETANDCOUNT, made by islptng.

Data format

This esolang operates on a set(sorted) of positive integers.

Syntax

A list of tokens separated by spaces.

If it is a number N, it increments the Nth number in the set. If the set's size is even less than N, it increments all the numbers and add 1 into the set.

If it's something inside a brackets [x], it's a label and does nothing on its own.

If it's the name of a label, it jumps to the label only if the previous operation don't generate a duplicate. If it's a duplication, do nothing.

That's it.

Interpreter

Try it online!

Turing-Completeness proof

This section is still a work in progress. It may be changed in the future.

Consider this representation format of a 2-register Minsky machine which consists of these lines of code:

label a		-- define label a
goto a		-- go to label a
inc r		-- increment r
tdec r,a	-- decrement r, if already zero, go to a

where a can be any label name, and r can be x/y. Apparently, it's Turing Complete.

For we're operating on ordered sets, let's consider the following representation of two registers:

{a,b,c}

where x is b-a-1, y is c-b-1.
So now we have easy increment instructions:

3 2	-- inc x
3	-- inc y