I was assuming that Z = yoke(Z, ",", n) would be slower than Z = Z + "," + n because yoke( involves two comparisons to see whether the first or third arguments are empty. But it hadn’t occurred to me that Z = Z + "," + n involves two string concatenations, and I don’t know how long they would take in comparison.
You’re right: averaging a thousand results to allow for external factors, I find my version to be about 5.5% quicker than Dave’s — but both under 6ms. Increasing the number of items created in the array from 94 to 10,000, my version (with arguably more in the loop but without the extra statement at the end) becomes about 1.7% slower than Dave’s — which is the kind of difference I meant by ‘fractional’!
Following up on the bug report aspect of this thread, it looks like every 32nd time through the loop, the first statement in the loop is executed twice. If I make that statement a NOP, the results are correct.
let n=6 //first number of the array
Z=Z[2,-1] // gets rid of the leading comma
Actually, it’s the same behavior both times. When a number seems to be skipped, it’s because the assignment statement that increments the counter is the first statement in the loop, and it gets implemented twice. When the number appears twice, it’s because the assignment statement that adds to the array is the first statement in the loop, and that gets done twice.
I think you have that backwards. There have been no problems reported with For loops, and when Tom used Until 70 as his end condition, he didn’t have a problem either. The examples that have had problems have had stoploopif or until statements with a comparison operation as the end condition. Those that used internal counters had no problem.
The procedure that started this thread had only 3 statements within the loop. I wouldn’t call that complicated.