Re:Some Insights from a Julia Developer
by 88e282102ae2e5b on Saturday October 14, 2017 @01:14PM
(#15473110)
I didn't mean to seem petty, it's just that going back and forth between zero-based and one-based languages just added extra mental overhead (admittedly this was with Fortran, so there may have been other issues).
[ Parent
| on HN ]
Re:Some Insights from a Julia Developer
by ssivark on Saturday October 14, 2017 @01:27PM
(#15473169)
The way I think of it is that different indexing schemes suit different problems. I want to think carefully about the problem domain and use the most convenient convention. For example, when my array stores a time series, I would like the index to correspond to timestamps (and still be performant, so long as my timestamps can be efficiently mapped to memory locations, which is true for affine transformations, for example). When another array stores the Fourier transform of that time series, I would like to access elements by the frequency they correspond to. That stops me from making annoying indexing errors (eg: off-by-1), because the data structure's interface maps nicely to the problem domain. I find that much easier than the cognitive cost that comes with trying to shoehorn a single convention on every situation. But it's difficult to appreciate that when thinking of language constructs divorced from specific problem domains, as one tends to do when typically studying data structures and/or algorithms.
Re:Some Insights from a Julia Developer
by simonbyrne on Saturday October 14, 2017 @11:51PM
(#15475794)
Fourier transforms are a great example: when I started with Julia, this was the only time I missed 0-based indexing.
Now there is the awesome FFTViews.jl package which goes one better with wrap-around indexing: https://github.com/JuliaArrays/FFTViews.jl
Sounds like https://github.com/JuliaArrays/AxisArrays.jl/ ;)
Re:Some Insights from a Julia Developer
by tlarkworthy on Saturday October 14, 2017 @03:11PM
(#15473694)
I am so sold I want to learn right now.
Re:Some Insights from a Julia Developer
by chrispeel on Saturday October 14, 2017 @01:23PM
(#15473148)
I think it crucial to offer at this point the important Julia package TwoBasedIndexing.jl :-)
Honestly, given how much work I do in R, and how much the assumption of 1-based indexing is in my field, this is a massive Julia selling point for the exact same mental overhead reasons you mention.