Here are 2 functions:
def Foo1(s: ((BigInt, Long) => Long)
=> ((BigInt, Long) => Long)): (BigInt, Long) => Long = s(Foo1(s))
def Foo2(s: (=> (BigInt, Long) => Long)
=> ((BigInt, Long) => Long)): (BigInt, Long) => Long = s(Foo2(s))
When they are called with the following parameters:
Foo1(rec => (x, s) =>
if (x == 1) s
else rec(if (x % 2 == 0) x / 2 else 3 * x + 1, s + 1))(56, 0)
Foo2(rec => (x, s) =>
if (x == 1) s
else rec(if (x % 2 == 0) x / 2 else 3 * x + 1, s + 1))(56, 0)
The first causes stack overflow, and the second executes normally.
Also, what does this expression mean: (=> (BigInt, Long) => Long)?