"Well," I said to myself as I read this article, "this wouldn't work if you had to iterate through multiple arrays simultaneously." Then I was enlightened as I realized the intended purpose of the zip function.<p>This followed by disappointment, as I was unable to experience a similar enlightenment for cases that did not have completely embarrassing data parallelism. For instance, given arrays A, B, and C, we want to set A[i] = B[i-1] + C[i+1] (with special cases at boundaries). How would you do this with the map/filter/fold primitive recursion patterns?<p>Edit: Upon thinking of it more, would slices do the trick? So, in Python:<p><pre><code> A = [0,0,0,0,0]
B = [1,2,3,4,5]
C = [6,7,8,9,10]
A[1:-1] = map(sum, zip(B[:-2], C[2:]))
</code></pre>
Is there a better way to do this? I would say it is much less easy to read than A[i] = B[i-1] + C[i+1]. I would probably have to add a comment to the effect of "this is what this line is doing", which goes against the self-documenting argument.