News for hackers. Stuff that matters.
Re:The unreasonable effectiveness of the Julia programming l... by pasabagi on Saturday October 10, 2020 @04:27PM (#24741638)
I also didn't think it was a big deal - I write a lot of lua, and I love lua - but every time I have to do anything involving modulo maths and arrays it's a pain in the ass.
Re:The unreasonable effectiveness of the Julia programming l... by ddragon on Saturday October 10, 2020 @05:42PM (#24742083)
Julia makes it easier for example with functions that handle mod in the context of 1-indexed arrays (if you don't want to use OffsetArrays).

https://docs.julialang.org/en/v1/base/math/#Base.mod1

Re:The unreasonable effectiveness of the Julia programming l... by pasabagi on Saturday October 10, 2020 @06:11PM (#24742240)
Well, that seems cool, but isn't indexing from zero simpler?

I don't really remember if zero-indexing was a big deal when I was learning to program. Are there big advantages for non-programmers? I figure that's why Lua went the 1-index route.

Re:The unreasonable effectiveness of the Julia programming l... by ddragon on Saturday October 10, 2020 @06:48PM (#24742462)
>I don't really remember if zero-indexing was a big deal when I was learning to program

And neither is 1-indexing even though people are always complaining about it. I kinda like when indexing from the third element to the seventh element to be just 3:7, instead of 2:6. and the last element to be length(x) instead of length(x)-1. And that use case is much more frequent to me than creating circular buffers on an array. And in Julia you can just use begin:end as well, or any iterator, it's really overall a non-issue for me.

Not sure about Lua, but in Julia (and Matlab, and R) is just because they actually have vectors/matrices types that have a convention that predates even programming, while it makes sense for languages that an array is basically a memory offset (that maps to a pointer arithmetic logic) to start in 0.