Oops, somehow my reply got sent before I finished it!
About the division: I do think that Julia is not consistent with the / 
operator.  Other operators almost always return something of the same type. 
 While there is the Unicode character ÷ operator, which does integer 
division, that's a pain to type (5 keystrokes vs 1).
I do think it would be better if / used the same promotion rules as *.
When dividing by a constant where you want to ensure a floating point 
result, I don't think it's so difficult to add a . to the numeric literal, 
instead of causing the confusion and/or extra keystrokes that the current 
definition causes.
Also, I don't think there is anything about the ÷ character that screams 
out "integer division" vs. "floating point division".
(Is that a convention in any other language, that I'm just not aware of?)

On Saturday, April 2, 2016 at 7:55:55 AM UTC-4, 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
>

Reply via email to