I love functional programming in Octave, but it's rather unwieldy in practice. I'm wondering about the shortest way to define an anonymous recursive function.
I have some ideas, but I'm wondering if there is a way to combine these ideas to make them even shorter (or equally short but more versatile). For the sake of this question, let's recursively count down to zero (just to keep the payload as simple as possible).
If my reasoning is correct, none of the variable names I used in the following examples should overlap. The desired function is
q(n), which should always return zero.
i is used as a counter variable,
f is the recursive function which I have called
g in the local scope of
44 bytes, "inline definition of
44 bytes, "argument list definition of
44 bytes, "separate definition of
41 bytes, "desired function as a return value"
The current 'winner' is inspired by this answer by flawr. However, given the large range of different ways to do this, perhaps someone can think of an even shorter combination of methods.
The goal is of course to get it below 39 bytes for a "full" function, Try it online!