A method of replacing an explicit loop by the "each" operator was studied. The repetitive, computational part of the loop was extracted into a function FOO. Then, the function was applied to each value of the loop counter vector C (FOO "each" C). Since array operations are optimized on most APL systems, this replacement should produce a most reasonable loop, assuming that in the function FOO array operations were used as much as possible. Two examples of performance measurements showed that this, generally, did not lead to smaller execution time. In one example the "each" operator was faster than an explicit loop while in another the opposite was true.
/lp/association-for-computing-machinery/replacing-an-explicit-loop-by-the-each-operator-Tb9wq9LJU4