|
|
Subscribe / Log in / New account

An introduction to the Julia language, part 1

An introduction to the Julia language, part 1

Posted Aug 29, 2018 20:07 UTC (Wed) by Cyberax (✭ supporter ✭, #52523)
In reply to: An introduction to the Julia language, part 1 by danielpf
Parent article: An introduction to the Julia language, part 1

0-based indexing makes it MUCH easier to do array manipulation because position within an array and the offset from its start are the same. It's not true for 1-based indexing (the first position is "1" but its offset is "0").

It's easy to illustrate, for example, on a simple circular buffer:
C: buf[pos % BUF_SIZE] = 1
Pascal: buf[(pos-1) mod BUF_SIZE + 1] = 1


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds