News for hackers. Stuff that matters.
Re:Ruby vs. Python comes down to the for loop (2021) by lelanthran on Monday April 22, 2024 @01:08PM (#40116362)
> My argument is that there is no 1:1 mapping: for instance, "for (i=0, j=10; s[i]; t[j--] = s[i++])" has no direct correspondence with sigma notation.

And? I didn't claim that all the multi-expression, body-in-the-conditional possibilities are a 1:1 mapping with sigma notation, did I?

Why do you think this is more representative of for loops in C than simpler examples I gave?

> or you meant by "1:1 mapping" something quite different from what I mean.

Well, yes. I meant that the 1:1 mapping is from sigma notation to C, not the other way around, because sigma notation was not invented after the C language.

Maybe I shouldn't have said 1:1 mapping; it's much clearer to say "The `for` loop in C is just a way to write sigma notation in programming languages".

There are no comments on this comment yet.