News for hackers. Stuff that matters.
Re:Mindset Shifts for Functional Programming by sokoloff on Wednesday April 05, 2023 @02:28PM (#35458483)
> If the recursion can be tail called optimized then yes the loop is the optimized performant implementation.

Is it? My mental model of tail-call optimization is that it’s just a replacement of the stack variable values in place and a jump to the function entry point (which seems like the same amount of work as updating local variables in a loop and jumping to the head of the loop).

There are no comments on this comment yet.