3 ms·
I am aware but it misses the point. Parallel computation is just one example. What about traversing trees? Graphs? Any functor? Any compiler directions to
by nightski 14y ago
I am aware but it misses the point. Parallel computation is just one example. What about traversing trees? Graphs? Any functor? Any compiler directions to automagically make the for loop traverse those?
And that does not even address the issue of composability - which is even more important. Map fusion?
- pacala 14y agoBottom up tree traversal doesn't require an explicit for loop as long as the language supports first class functions. bottomsUp(node) { recurseChildren(node, &bottomsUp); switch (node.id) { case FOO: break; case BAR: break; } } At the end of the day the actual code (the switch) is what matters, and the "glue" can be made a couple of lines either way. PS. On a separate language feature, I like match with algebraic datatypes more than switch, but I don't know if Go has match. Go Rust!