Stasis

From Esolang
Jump to navigation Jump to search
Stasis
Paradigm(s) imperative
Designed by Daniel Temkin
Appeared in 2011
Computational class Turing complete
Reference implementation Stasis
Influenced by Entropy
File extension(s) .cs (runs as C# dialect currently)

Stasis is a pre-Socratic language first produced in the 5th Century BCE, recently revived by User:Rottytooth

Philosophy

We can speak and think only of what exists. And what exists is uncreated and imperishable for it is whole and unchanging and complete. It was not or nor shall be different since it is now, all at once, one and continuous... - Parmenides
  • the universe is in constant balance
  • there is only one number, its value is zero
  • other numbers are illusory, refractions of zero

Language Overview

Stasis transpiles to C#, with all primitives replaced with Stasis structs. It could just as well be implemented in JS or really any other procedural syntax. Each time a value is assigned, all other variables are adjusted to keep a collective sum of zero, but maintaining the same ratios. Like Entropy, Stasis has no true ints or chars; behind the scenes, each of these types are represented by a float. In Stasis, an int is the closest whole-number for the current value.

char

Chars are a special case in Stasis. Like ints, each is rounded to the closest whole number, then returned as the corresponding Unicode character. However, since there are no negative values in Unicode, every character in the Unicode table is interpreted as its negadecimal equivalent, making half the characters negative.

Examples

Dealing with ints

void main()
{
	int a = 1;
	Console.WriteLine(a);
}

Output:

0

Since there is no other variable to balance a with, its value remains zero

void main()
{
	int a, b = 5;
	Console.WriteLine(a);
}

Output:

-2.5

Hello World

Printing the "Hello, World!" string straight would end up "averaging" all the characters around zero, giving us:

????§PX?§???Y

Each character of the Hello World string is adjusted by each that come after. The very first value introduced in the program will go to zero, so we start with a float we will not use again. Then the others are added as Floats, so that after re-calculating, they end up in the correct place:

void HelloWorld()
{
   Float j = 0; // a throw-away value that would become zero anyway
   var hw = new String(601, 420.6666666666667, 320.75, 256.6, 216.33333333333333, 128.85714285714286, 101.37499999999999, 139, 147.60000000000002, 136, 119.16666666666666, 103.53846153846153, 33);
   Console.WriteLine(hw);
   Console.WriteLine("\n");
}

Implementations

Partial Implementation in C# (partial indicating it does not force the user to use ONLY Stasis-aware variables)