This=That 2.0

From Esolang
Jump to navigation Jump to search

Language Overview

This=That 2.0 is an extension of This=That invented by User:A that adds some other special values including arrays of numbers that a variable takes. For example:


sets #x to the numbers 1, 2, 3, and 4. While:


sets #x to all positive integers. Also:


sets #x to the numbers 1, 5, and -84. These can be used in loops like this:

if loop a=#x~~3
if loop a=end

This sets the array of numbers (x) to 1, 2, 3, 4. Because at least one value of x suffices to the condition, the if loop runs. #x:~~3=0 sets all values equal to 3 in #x to 0, so the new value of #x is 1, 2, 0, 4. The # symbol must precede all array names. The delete value can be used to remove values from an array. In the following:

if loop a=#x~~3
if loop a=end

Instead of 3 being changed to 0, it is deleted, leaving #x set to 1, 2, 4.

Comments can be used and are enclosed in square brackets [].


Infinite prime number generator

#a=2-> [sets array a to all integers greater than or equal to 2.]
b=2 [sets b to 2]
while loop x=b>1 [starts a while loop called x that runs as long as b is greater than 1 (this 
                  runs infinitely because b will never decrease its value below 2)]
#c=#a times b [sets array c to the value of array a times the value of b]
#a:~~#c=delete [deletes all values in array a that are also in array c]
b=b plus 1 [increases b by 1]
#a:<b=print [prints the values of array a less than the value of b]
#a:<b=delete [deletes the values of array a less than the value of b]
while loop x=end [ends while loop x]

Computational Class

It is Turing-complete, because This=That is Turing-complete. Additionally, an array can be used for the 3 variables, and even more.

See also