News for hackers. Stuff that matters.
Re:Reading Awc by itishappy on Wednesday June 05, 2024 @07:45PM (#40591924)
Sometimes, particularly in mathematical code, I want the focus to be more on the operators than the variables. I see this style all over the place on Shadertoy.

    # hyperbolic and contrived example in fake c
    for (int i = 0; i < len(a) - 1; i++) {
        s += a[i] ^ 2 + a[i+1] ^ 2;
    }
    # vs
    for (int index = 0; index < len(array) - 1; index++) {
        sum += array[index] ^ 2 + array[index + 1] ^ 2;
    }
Arthur's style takes this way past my comfort levels, and it make sense he'd prefer array languages! Check out his Game of Life implementation:

    a:{3=s-x&4=s:2(+-1+/':)/x}
https://web.archive.org/web/20220926225051/https://kparc.com...

There are no comments on this comment yet.