Hacker News new | past | comments | ask | show | jobs | submit login

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.




Can't you just use mod(x, 1:n)? Or mod(i, eachindex(vals))?


Lol, this is so nice. It is literally what OP asked for: " modulo to remain within some range" is just mod(myvalue, myrange)


It'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).


I'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.


Julia has the function mod1 which is just mod + 1, just in case that's ever useful for you :)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: