Zeno

From Esolang
Jump to: navigation, search

Zeno is an esoteric programming language by User:Rdococ. It is designed for hypercomputation on the Infinity Machine, which enables infinite, rather than unbounded, memory, and the ability to complete supertasks.

Overview

It only makes sense if we implement useful types that utilize the capacity of the machine. So Zeno implements real numbers:

real x = sqrt(2);
real y = x^2;

print(x); // Prints an infinite string corresponding to the exact decimal representation of x, despite being an irrational.
print(y); // Prints exactly 2, with no rounding errors because no rounding is required.

Additionally, the Zeno construct can complete a (countably) infinite process in a finite amount of time, through the computational equivalent of Zeno's paradox. Here, it counts countable infinity and prints it out. The whole process takes two standard clock cycles by doubling the speed of the processor at every cycle, halving the amount of time it takes.

real x = 0;
zeno {
     for (i=0;;i++) {
          x = x + 1;
     };
};
print(x); // Prints the number of natural numbers; in other words, countable infinity.

Limits no longer need to be mathematically guessed; you can just brute-force it:

function limit(f, x) { // This is a limit which approaches from the right.
     real epsilon = 0.1;
     real result = 0;
     zeno {
          for (i=0;;i++) {
               epsilon = epsilon / 2;
               result = f(x+epsilon);
          };
     };
     return result;
};
function liminf(f) { // This is a limit which approaches +infinity.
     real result = 0;
     zeno {
          for (i=0;;i++) {
               result = f(i);
          };
     };
     return result;
};

function approachTwo(x) {
     real result = 0;
     real offset = 1;
     zeno { // Precaution for large x.
          for (i=0;i<x;i++) {
               result = result + offset;
               offset = offset / 2;
          };
     };
     return result;
};
print(liminf(approachTwo)); // Returns the correct answer of two. Note that one zeno construct is infinitely nested in another.

Interpreters

Here's an interpreter I wrote in Lua.

Conclusion

Clearly, this is an incredibly useful language; the only drawback is that it's mathematically impossible to implement under the current understandings of computer science, physics, and basic logic.