> Decisions that in my opinion were made by people who do not write research-code: > 1. Indexing in Julia. being 1 based and inclusive, instead of 0 based and not including the end (like in c/python/lots of other stuff) > 2. No simple integer-division operator.
I do not understand why this is related to research code. In fact, if it would ever be then I think it would be exactly the other way around, more close to basic mathematics: stuff gets enumerated as 1st, 2nd, etc., and a division of two integer numbers may give non-integral results! Curiously for me, who only knew C, C++ and Python for many years, the 0-based indexing never made any "mathematical" sense. I always have seen it as a useful hack to do pointer arithmetic. Although it enables shorter code, I always had the need to do a mental conversion between what the algorithm looks like in my head and how it must look like in the source code. When I first learn Julia the 1-based indexing just felt so natural! However, I think this is really an issue that cannot make a language better or worse. In the end, it will be a lot more related to programmer familiarness and personal preference than something else. On Saturday, April 2, 2016 at 12:55:55 PM UTC+1, Spiritus Pap wrote: > > Hi there, > > TL;DR: A lot of people that could use julia (researchers currently using > python) won't. I give an example of how it makes my life hard, and I try to > suggest solutions. > > Iv'e been introduced to julia about a month ago. > I'm an algorithmic researcher, I write mostly research code: statistics, > image processing, algorithms, etc. > I use mostly python with numpy for my stuff, and C/++ when I need > performance. > I was really happy when I heard of julia, because it takes the simplicity > of python and combines it with JIT compilation for speed! > > I REALLY tried to use julia, I really did. I tried to convince my friends > at work to use it too. > However, there are a few things that make it unusable the way it is. > > Decisions that in my opinion were made by people who do not write > research-code: > 1. Indexing in Julia. being 1 based and inclusive, instead of 0 based and > not including the end (like in c/python/lots of other stuff) > 2. No simple integer-division operator. > > A simple example why it makes my *life hard*: Assume there is an array of > size 100, and i want to take the i_th portion of it out of n. This is a > common scenario for research-code, at least for me and my friends. > In python: > a[i*100/n:(i+1)*100/n] > In julia: > a[1+div(i*100,n):div((i+1)*100,n)] > > A lot more cumbersome in julia, and it is annoying and unattractive. This > is just a simple example. > > *Possible solutions:* > The reason I'm writing this post is because I want to use julia, and I > want to to become great. > *About the division:* I would suggest *adding *an integer division > *operator*, such as *//*. Would help a lot. Yes, I think it should be by > default, so that newcomers would need the least amount of effort to use > julia comfortably. > > *About the indexing:* I realize that this is a decision made a long time > ago, and everything is built this way. Yes, it is like matlab, and no, it > is not a good thing. > I am a mathematician, and I almost always index my sequences expressions > in 0, it usually just makes more sense. > The problem is both in array (e.g. a[0]) and in slice (e.g. 0:10). > An array could be solved perhaps by a *custom *0 based *array object*. > But the slice? Maybe adding a 0 based *slice operator*(such as .. or _)? > is it possible to do so in a library? > > I'd be happy to write these myself, but I believe these need to be in the > standard library. Again, so that newcomers would need the least amount of > effort to use julia comfortably. > If you have better suggestions, I'd be happy to hear. > > Thank you for your time >