Size: a a a

2019 September 29

MG

Matthew Good in Kotlin Start
Denys
Unfortunately I'm not familiar with trampolines. I guess we need functional programming expert here.
ok
источник

MG

Matthew Good in Kotlin Start
for example, this is state recursive
fun digit() {
   // create a state machine that accepts integer input in the form of a string
   val FiniteStateMachine = StateMachines().FiniteStateMachine<String>()
   FiniteStateMachine.state.add(FiniteStateMachine.state.defaultState()) {
       when (FiniteStateMachine.getInput()) {
           "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" -> {
               println("is digit")
               
it.stateList[0].action()
            }
           null -> println("EOF")
           else -> println("is not digit")
       }
   }
   FiniteStateMachine.input = "12345678964457647".toStack()
   FiniteStateMachine.executeDefault()
}

in which given the input, would have an end recursion depth of 17
источник

ᵛᵉⁿᵈᵉˡⁱᵉᵘ in Kotlin Start
Denys
data.chunked(3):

fun main() {
   (0..10)
       .map { it }
       .chunked(3)
       .let(::println)
}
спасибо большое за подсказки
источник

MG

Matthew Good in Kotlin Start
источник

MG

Matthew Good in Kotlin Start
(not sure if it also counts for dynamically added functions such as in my case of a lamda list)
источник

MG

Matthew Good in Kotlin Start
https://pl.kotl.in/npFEmt2tx oh ;-;
Exception in thread "main" java.security.AccessControlException: Access control exception due to security reasons in web playground: 
access denied ("java.util.PropertyPermission" "kotlin.ignore.old.metadata" "read")
at FileKt.main (File.kt:-1)
источник

MG

Matthew Good in Kotlin Start
is thare any way around this?
источник

RI

Ruslan Ibragimov in Kotlin Start
Matthew Good
https://pl.kotl.in/npFEmt2tx oh ;-;
Exception in thread "main" java.security.AccessControlException: Access control exception due to security reasons in web playground: 
access denied ("java.util.PropertyPermission" "kotlin.ignore.old.metadata" "read")
at FileKt.main (File.kt:-1)
Works for me:
источник

MG

Matthew Good in Kotlin Start
Ruslan Ibragimov
Works for me:
that isnt the link i sent o.o
источник

RI

Ruslan Ibragimov in Kotlin Start
Your code takes more than 10s, use local machine for development
источник

MG

Matthew Good in Kotlin Start
ok
источник

RI

Ruslan Ibragimov in Kotlin Start
Yes, because this is what you trampoline function do, until you pass null as first argument
источник

RI

Ruslan Ibragimov in Kotlin Start
Try to think about your code, try to debug it in IDEA, before asking questions
источник

MG

Matthew Good in Kotlin Start
@HeapyHop would this be a correct Trampoline implementation? https://pl.kotl.in/s8_IIXPUz as it appears to work as it hasnt thrown a stack overflow error yet
источник

MG

Matthew Good in Kotlin Start
as its currently on ~933000000
источник

RI

Ruslan Ibragimov in Kotlin Start
Matthew Good
@HeapyHop would this be a correct Trampoline implementation? https://pl.kotl.in/s8_IIXPUz as it appears to work as it hasnt thrown a stack overflow error yet
You take 13 mins, to undestand that you send incorrect link :) Yes, looks better
источник

MG

Matthew Good in Kotlin Start
Ruslan Ibragimov
You take 13 mins, to undestand that you send incorrect link :) Yes, looks better
ok
источник

MG

Matthew Good in Kotlin Start
odd: n: 924642246
even: n: 924642245
odd: n: 924642244
even: n: 924642243

Process finished with exit code 130 (interrupted by signal 2: SIGINT)
источник

MG

Matthew Good in Kotlin Start
i assume most kotlin programs would stack overflow well before reaching this recursion "depth" right? eg around 75357756 or so nested function calls, which means the trampoline works right?
источник

RI

Ruslan Ibragimov in Kotlin Start
Matthew Good
i assume most kotlin programs would stack overflow well before reaching this recursion "depth" right? eg around 75357756 or so nested function calls, which means the trampoline works right?
Correct
источник