$ 0 0 I don't have any solution right now but if regular tailrec is impossible, maybe you could consider using a trampoline ?