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

I love haskell, but personally don't want haskell ideas to be popular until they're possible for a given language. Yes, lazy evaluation and tail-call recursion are awesome... At least they are in haskell. Outside of haskell, it's just a fun trivia fact that some other language does it.


I've got a blog post in the oven about tail-call recursion and how to use it in F# to write your loops more safely. By using recursive (possibly side-effectful) functions instead of iteration, you make the decision about "whether or not to loop" explicit in code, making it much harder to make e.g. certain classes of off-by-one errors. When it's an explicit decision to loop, by calling yourself with an amended immutable state parameter, it often sticks out like a sore thumb when you loop wrongly (e.g. by forgetting to update your state, or by looping one too many times).




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

Search: