Lambda recursive ...

Boaz Nahum boaznahum at gmail.com
Fri Oct 19 06:09:03 PDT 2012


I remember it was said that the below is valid code:

interface FactInt { int invoke(int i); }

 FactInt factorial = i ->
                { return i == 0 ? 1 : i * factorial.invoke(i - 1); };

But the compile (b61) says:
error: variable factorial might not have been initialized

How can I write recursive expression like this ?

Thanks
Boaz


More information about the lambda-dev mailing list