Hi, I've been playing around with Gleam for work and I came across some issues with recursion and Erlang. This is not necessarily an issue with Gleam.
I noticed that while the Gleam compiler is able to convert explicitly tail-recursive code into a loop for JavaScript, the TCO implemented by Erlang struggles quite a bit and causes gleeunit to crash (which I assume is due to a memory limit reached) (1st image)
Here's the code I've been using.
Is this a generally known issue in Erlang or is there something I've missed?
Another fun thing is that the JS and Erlang targets disagree on the result for tail_sum_even(300_000_000) (2nd image)
A playground for the Gleam programming language. Write, run, and share Gleam code in your browser.