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