Is there language support for anonymous recursive functions in TADS 3? Something like arguments.callee in Javascript, so the function can reference itself even though it doesn’t have a name?
The Y combinator approach works but is somewhat opaque.
test() {
	local Y = new function(f) {
		local g = {h: {x: f(h(h))(x)}};
		return g(g);
	};
	local factorial = Y({f: {x: x == 0 ? 1 : x * f(x-1)}});
	local fibonacci = Y({f: {x: x == 0 ? 0 : (x == 1 ? 1 : f(x-1) + f(x-2))}});
	tadsSay(toString(factorial(5)),'\n');
	tadsSay(toString(fibonacci(10)),'\n');
}