Hacker News new | ask | show | jobs
by collinf 2873 days ago
My only fleeting experience with Julia is in a Numerical Analysis Course three years ago... but it has 1-indexed arrays so its good for scaring away all people who are programmers before analysts/scientists!

Really though, I think it has a better type system and a syntax that translates easier to mathematical expressions. Other than that, Python's breadth of packages will be hard to overcome.

4 comments

I know it is not the default, but this package has no overhead over the default arrays according to recent benchmarks, and provides 0-indexed arrays: https://github.com/JuliaArrays/OffsetArrays.jl

I confess, not being the default is a big thing. I've definitely had times where I thought "this would be easier with 0 indexed arrays", but it can then be harder to commit to adding a dependency and making that change vs just adding awkward looking "+1"s to all the indexes. Coming from math/science, there's lots of times 1-indexing makes more sense / is more familiar. It's normal there to start counting from 1, so it can be easier to translate.

It's non uncommon in mathematics to index from zero as well.
You get used to the 1-based indexing pretty quick. It's a non-issue. 1-based indexing is the standard in math, and also Matlab and Fortran. For the primary use-case of Julia, it makes sense. Julia REALLY tries to be easy for Matlab users, who still dwarf Python users in science.
> Julia REALLY tries to be easy for Matlab users

Not so much currently:

https://discourse.julialang.org/t/why-eye-has-been-deprecate...

When I started programming, all my languages with exception of Assembly used 1-indexing, so no, it doesn't scare all programmers.
Even among scientists there are people who don't like 1-indexed arrays (me, one data point)! However, Julia 0.7 and 1.0 have the keyword "begin" so that you can basically program arrays in an index-agnostic way.