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

> number of elements to process is exactly the difference between last and first index of the range

And in Julia, it’s

  length(a:b)
which also works with non-unit step sizes like

  length(a:x:b)
The intent of these expressions seems clearer than the intent of `b-a` and `ceiling((b-a)/x)` with your proposed approach in a zero-indexed language.



Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: