Deep recursion
sumTo : Int -> Int = \n. (if (eq n 0) 0 (add n (sumTo (sub n 1))))
-- A tail-recursive loop runs in constant space.
countDown : Int -> Int = \n. (if (eq n 0) 0 (countDown (sub n 1)))
(println (show (sumTo 10)))
(println (show (sumTo 100000)))
(println (show (countDown 1000000)))
Output
55
5000050000
0
Run it yourself from the repository root: lbd run tests/golden/programs/deep_recursion.lbd