Bob Glamm
07/24/2019, 6:38 PMtailrec suspend fun factorial(n) = if(n == 1) { 1 } else { n * factorial(n - 1) }
pakoito
07/24/2019, 6:43 PMBob Glamm
07/24/2019, 6:43 PMBob Glamm
07/24/2019, 6:44 PMtailrec suspend fun foo(n) = if (n == 1) { 1 } else { foo(n-1) }
Bob Glamm
07/24/2019, 6:45 PMfoo(700000)
and watched the stack trace of the thread in IJ debugger with a breakpoint on `foo(n-1)`; stack depth stayed constantpakoito
07/24/2019, 6:47 PM