We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Oracle

From Esolang
Jump to navigation Jump to search
For the computational model, see oracle machine.

Oracle is an esoteric language by User:Rdococ. It's like any other language, except it has a halting oracle which takes in a function and returns whether the function will halt or not. While it is super-turing complete in the sense that it can solve the halting problem for both Turing complete programs and Oracle programs, I honestly didn't find it to be that particularly useful, except for maybe optimizing boolean-returning functions.

Examples

// This function either destroys the universe, somehow avoids being run in any universe or causes an error message, depending on implementation.
// Note that if the hypothesis of quantum suicide holds true, then the two former possibilities are equivalent.
// The third may be too, if someone's holding you hostage and will kill you if you cause an error message.
// Well, unless you cause an error message and then escape before they can kill you.
// There's also the off chance that you can survive the destruction of the universe.
// TL;DR, don't run this code.
function paradox() {
	if (halts(paradox)) {
		while (true) {

		};
	} else {
		return;
	};
};
paradox();
// This function checks whether x is prime, at the speed of the halting oracle rather than the speed of the function itself. All functions that return a boolean can be optimized this way.
function isPrime(x) {
	return halts(function (x) {
		var i = 2;
		while (i < x) {
			if ((x/i)%1 == 0) {
				return;
			};
			i++;
		};
		while (true) {
		};
	}, x);
};