to get gcc to tail-call any recursive proc you need to write it in an awkward way, making sure the last statement is the recursive call.
but doing so with a closure or a proc results in tail-call optimization, at least for this toy example: <https://godbolt.org/z/9s5b3Tzb5> giant YMMV applies, obviously, but interesting i thought.