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

...re-reading this I realize the comments are a bit of a mess... basically, it's a decorator that uses the y-combinator to get around the recursion depth problem by "suspending" the evaluation at each step (I'm sure there's some technical term for this... thunking?), then later performing each evaluation inside a while loop. I tested it a bunch and it seemed to work on anything.

I recall being convinced keyword arguments could be made to work, and also that some byte code hacking would get around the "non-user friendly" bit where recursive functions need to be written as "functionals" in order to expose the recursive function itself as a fixed point.



Reminds me of javascript trampoline http://raganwald.com/2013/03/28/trampolines-in-javascript.ht... . Was it an inspiration or did you recreate it from scratch ?


It was cobbled together more or less from scratch mainly based on stackoverflow questions and wikipedia articles. To be honest, it was still somewhat opaque to me (hence the extraordinarily long comments--trying to explain it to myself) but the javascript link makes things much clearer! Thanks




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

Search: