Edit:
To @Mat who thinks the existing syntax cannot possibly be any simpler, what I have in mind is something like the following (pseudo-C#):
//This is just setting up the scenario.
List nest123 = {1, 2, 3};
List nest456 = {4, 5, 6};
List nest789 = {7, 8, 9};
List whole = {
0,
1,
nest123,
nest456,
nest789
};
int cuml = 0;
//This is where the action occurs.
Recor (List a = whole) {
for (int i = 0; i < a.Length; i++)
if (a[i] is int) cuml += a[i];
if (a[i] is List) Recurse(a[i]);
};
};
//Once control reaches this comment line, the 'cuml' variable should have the value 46.
There's two novel keywords here, Recor and Recurse.
'Recor' is just a made-up word specifying the type of block (like 'for' would for the for-loop block). The 'Recurse' keyword causes the containing Recor block to re-enter at the top as a recursive call, with the specified parameter.
When the Recor-block is first entered, it's parameter 'a' is explicitly initialised.
When the Recor-block is recursively entered, the variables from outside the block remain in scope as before, but the variables within are all reset, and the parameter is set to the value given at the site of the calling Recurse keyword.
When the end of the Recor-block is reached, either control returns to the point in the context where the Recurse keyword was last invoked (and all the variables local to that context are also restored), or the Recor-block is exited if all recursive calls are already unwound.
It's all very similar to how recursive calls work already, except without the ceremony of naming the recursive method, without defining the parameters separately from their initialisation, and without having to explicitly call the method for the first time.