Previous: On-line Help, Up: Other Features


3.5 Parallel Binding and Stepping

The parallel binding and stepping of variables is a feature that iterate does not have. This section attempts to provide a rationale.

We say that two variables are bound in parallel if neither binding shadows the other. This is the usual semantics of let (as opposed to let*). Similarly, we can say that iteration variables are stepped in parallel if neither variable is updated before the other, conceptually speaking; in other words, if the code to update each variable can reference the old values of both variables.

loop allows parallel binding of variables and parallel stepping of driver variables. My view is that if you are depending on the serial/parallel distinction, you are doing something obscure. If you need to bind variables in parallel using with, then you must be using a variable name that shadows a name in the existing lexical environment. Don't do that. The most common use for parallel stepping is to track the values of variables on the previous iteration, but in fact this does not require parallel stepping at all; the following will work:

  (iter (for current in list)
        (for prev previous current)
        ...)