3 ms·
Tough luck. Using 0-indexing would have lost Matlab users to the Julia community. So they consciously decided to rather lose you. :-) I got used to switching b
by jpfr 6y ago
Tough luck. Using 0-indexing would have lost Matlab users to the Julia community. So they consciously decided to rather lose you. :-)
I got used to switching between 0/1-indexing. The only place it actually hurts is when using modulo to remain within some range. And this is needed much much less in Julia than in C and C-like.
- contravariant 6y agoI'll accept using modulo as an argument when CPU manufacturers finally do the sane thing and make sure that x mod n is always a non-negative integer.
- tptacek 6y agoIt's funny, from the votes on my comment it seems like I came across as seriously criticizing Julia (a language I admire) rather than just being hyped about that video (which is excellent).
- vcxy 6y agoJulia has the function mod1 which is just mod + 1, just in case that's ever useful for you :)
- conistonwater 6y agoCan't you just use mod(x, 1:n)? Or mod(i, eachindex(vals))?
- shele 6y agoLol, this is so nice. It is literally what OP asked for: " modulo to remain within some range" is just mod(myvalue, myrange)