3 ms·
recur does two things: it checks that the call is in the tail position, and calls the JVM bytecode to GOTO the top of the function. The JVM has the bytecode to
by arohner 16y ago
recur does two things: it checks that the call is in the tail position, and calls the JVM bytecode to GOTO the top of the function.
The JVM has the bytecode to goto inside the current function, but doesn't have the instruction to jump to another function in constant space, which is why recur is the way it is.
- CodeMage 16y agoLots of nice info on SO on JVM and tail call optimization: http://stackoverflow.com/questions/105834/does-the-jvm-prevent-tail-call-optimizations http://stackoverflow.com/questions/105834/does-the-jvm-preve...