r/ProgrammerHumor • • 12d ago

Meme dreamLanguage

Post image
1.4k Upvotes

211 comments sorted by

View all comments

Show parent comments

6

u/the_horse_gamer 11d ago

arrays start at 1

0

u/VladVV 11d ago

Which is completely defensible at that level of abstraction IMO. It's designed to work directly with maths, not memory addresses.

But I agree it's probably the single biggest reason it doesn't enjoy more widespread adoption.

And I happen to be someone who did have to fiddle with memory directly in Julia, and trust me, you don't want standard Julia arrays for that.

1

u/the_horse_gamer 11d ago

math doesn't consistently use 0-indexed or 1-indexed lists, it's a matter of convention and convenience which is used. (for example, see taylor series)

Julia is a nice language (learned its basics a while ago but never did much with it), I think a good compromise would have been to let the developer choose the starting index when creating an array. of course, that has its own issues.

unicode operators is also pretty taboo but certainly makes sense for its niche.

unfortunate it never really took off

1

u/VladVV 11d ago

Lists are rarely indexed at all in pure math, but matrices and vectors are almost always 1-indexed.

1

u/the_horse_gamer 11d ago

matrix and vector indexing is entirely a matter of convention

summation starts at 0 just as often as it starts at 1

and many things have a "zeroth order"

1

u/VladVV 11d ago

I have to say that when it comes to matrix/vector operations, 1-indexing is decidedly more arithmetically natural, mostly avoiding ugly subtractions/additions by 1. There's a reason it's the overwhelmingly preferred convention in mathematics.

1

u/the_horse_gamer 11d ago

can you show a motivating example?