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

Branching iteration seems like a great idea. But I think the syntax shouldn't come from tree traversal. It should be something general. You tell the normal for loop how to go to the next sibling (`increment`) and when to end naturally (`condition`) or prematurely (`break`) and how to skip current sibling (in whole or partially) (`continue`). Branching iteration would also need to know how and when to branch, that includes skipping branching for this particular item, end whole iteration naturally and prematurely.

So something similar to `break` and `continue` should be the method of branching (descending into the tree).

I think Scala might be a great language to prototype implementation of such construct.



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

Search: