News for hackers. Stuff that matters.
Re:How Tail Call Optimization Works by eyelidlessness on Friday January 08, 2021 @02:37AM (#25682499)
I guess the way I’d try to help those people understand it is with the fiction I tell myself (which I alluded to upthread): I mentally model the “outer” function and the “inner” recursion as referencing different functions that have the same signature and the same body. The definition is concrete and self sufficient, it just dependency-injects a contract in its own image to delegate future work to. It’s even easy to literally implement that way in languages with first class functions, because you can just bind fn a to b and call b within a.

There are no comments on this comment yet.