Hacker News new | ask | show | jobs
by seles 1569 days ago
Cool, I had heard of defunctionalizing CPS before but never dared to try it.

I tried to follow along defunctionalizing map, but it is a bit different since it has a return value, whereas in the video it is a void. What I ended up with was equivalent to building a list and then reversing it. So it did infact work (all functions were tail callable). This was mentioned in the article as inferior to the author's final product though. So I think it is a bit different to a special case of CPS defunctionalization optimization.

Although there may have been other ways to deal with the return value in continuations...