Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I find Matt Might's post on this topic (Y in JavaScript) the best I seen (even though it's at least 8 years old by now): http://matt.might.net/articles/implementation-of-recursive-f...

It's clear, minimalist, insightful, and even has an in-page live code demo. Bonus points for including fixed-points as a key concept, and memoization as an extremely useful technique.



I've always liked that post, and I think it inspired me to do a similar thing.

That being said, I'm a big fan of decorators, so I expressed the memoization using a decorator, rather than baking it into Ymem.

On the other hand, trampolining is the perfect application for a special-purpose Y combinator, and thus the decoupled Trampoline.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: