Is it possible to do some anonymous recursion in Python ?
I mean, making a recursive lambda function, that does not call its name (so, it must work even if you don't assign the lambda).
Also, I know about the Y combinator (or other fixed-point combinators). I am aware that it is possible using different combinators. This is not what I am asking for.
I have read the wikipedia article https://en.wikipedia.org/wiki/Anonymous_recursion, that talks about how to do it with combinators, but I am searching for something more like the ∇
in APL, arguments.callee
in JS or Recall
in R (see the article).
Something like this :
fact = lambda n: 1 if n == 0 else n * ano_rec(n - 1)
would be perferct.
But, it could also be with a wrapper :
fact = ano_rec_wrapper(lambda n: 1 if n == 0 else n * ano_rec(n - 1))