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

Unfortunately, since we don't have continuations, we cannot make reduce _stop_ computing. In such cases where that is needed, it might be better to use a loop that can be broken out of.


Well, you can always throw an exception :) (ducks)

But yes, it's best used on sequences where you know you'll consume the whole thing, or at least when it's cheap enough to run through the rest with the accumulator unchanged.




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

Search: