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

> Dana smirks. “Well, yeah. JavaScript is an eager language. Can’t use the Y combinator.”

Does anyone know off the top of their head if the Z combinator would just work here? (Instead of switching to Skoobert)



You can make the Y combinator work in eager languages.

Famously, in Scheme and other Lisps. This website we are discussing on is written in a sort-of Scheme dialect.


Yep. The comment about eager languages I think is not really correct, as their eagerness is not really the problem. The problem is being bad at recursion and not having TCO, thus running into a stack overflow. But maybe even more correct would be to say that this or that JS engine doesn't implement TCO. Would Y have simply worked in Safari?


The Z combinator does work, but when you try to convert it into point-free form it starts crashing again. I tried pretty hard to avoid having to rewrite JavaScript for this article, but I couldn't find a way around it, since one of my constraints was making everything point-free.




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

Search: