Scala does optimize tail recursion at compile time
Scala does optimize tail recursion at compile time
I just got wowed. Scala does optimize tail recursion at compile time, I didn’t know that.
Say I have following countDown method —
public static void main(String[] args) { countDown(1_000_000_000); } public static void countDown(int n) { if (n == 0) return; System.out.println(n + " ..."); waitASecond(); countDown(n - 1); } private static void waitASecond() { // do some bla bla }
View On WordPress








