3 ms·
that loop code looks hideous. For the first: There's an implicit x->x+1 hiding in there? Why 'for y' if y is derived from x and not incremented on its own? Fo
by gowld 9y ago
that loop code looks hideous.
For the first: There's an implicit x->x+1 hiding in there? Why 'for y' if y is derived from x and not incremented on its own?
For the second: It looks like a nested (cross product) loop, but it's actually a zip (dot product) loop?
- kazinator 9y agoIt certainly does not look like it is one way or the other; it is something you have to know. If you don't know anything about loop, but have a belief that it is doing a Cartesian product, or a belief that it is not doing one, your belief has no rational basis either way. You can infer which one is right from the output. loop doesn't do cross-producting; if you know that, there is no mistaking it. All the clauses specify iteration elements for one single loop. "for x from 1" means starting at 1, in increments of 1. "for y = expr" means that expr is evaluated on each iteration, and y takes on that value. y could be incremented on its own, but then that example wouldn't show the "for var = expr" syntax, how one variable can depend on a combination of others.