Marc Knaup
12/28/2019, 2:48 PMsuspend fun main() {
recurse(1)
}
suspend fun recurse(n: Int) {
if (n % 1000 == 0)
delay(1)
println(n)
recurse(n+1)
print("")
}
Question is now how to implement that manually, with @RestrictsSuspension
and without the 1ms penalty 😄
And how to figure out a good n % something
as it depends on the stack size usage of each function in the call stack.Ruckus
12/28/2019, 4:52 PMdelay(1)
with yield()
Marc Knaup
12/29/2019, 1:11 AMlouiscad
12/30/2019, 3:08 PMMarc Knaup
12/30/2019, 4:13 PMsuspend fun main
is using.louiscad
12/30/2019, 9:18 PMtailrec
Marc Knaup
12/31/2019, 7:40 AMvisit children
and visit node … using visitor …
are controlled by me.
visitor….visit(…)
can be arbitrary code, by every class that implements a Visitor.louiscad
01/02/2020, 1:15 PMMarc Knaup
01/02/2020, 1:27 PM