I'd like to kick-up this thread again, and ask a related questions:

Let's say I have a 2d array, and take a slice of it. How do I then append 
the slice with an additional value? The slice is type Array{Float64,2}. 
Neither push! or append! work.

Thanks,
Alex

On Wednesday, April 16, 2014 at 5:25:36 PM UTC-5, Paweł Biernat wrote:
>
> Thanks for linking to the issue.  It seems that the array slicing is just 
> a tip of the iceberg, I had no idea about the discussion on the algebraic 
> interpretation of n x n arrays and respective operators.  I somewhat 
> understand the arguments behind the need of elementwise operators (although 
> they are still pretty arbitrary), but I find the current state of array 
> slicing really unintuitive.  I am new to Julia and I am constantly 
> impressed by its features but for my work a decent array slicing rules are 
> critical and lack of them is, to me, very annoying.
>
> W dniu środa, 16 kwietnia 2014 20:54:59 UTC+2 użytkownik Bob Nnamtrop 
> napisał:
>>
>> I completely agree with you and would love to see julia drop singleton 
>> dimensions indexed with scalar. There is an issue on this with lots of 
>> discussion, which was left at the point of waiting til someone implements 
>> some code to give it a try (see 
>> https://github.com/JuliaLang/julia/issues/5949). Maybe after 0.3 is 
>> released there will be some action on this (I am willing to try myself but 
>> it does seem like a hard 1st problem to deal with the julia internals).  
>> IMO, there is some underlying tension in julia that revolves around people 
>> who primarily use arrays as containers (who generally want this changed) 
>> and those who use one and two dimensional arrays as a linear algebra system 
>> (some of who do not want it implemented). I am firmly in the camp of using 
>> arrays primarily as containers and, in addition to this issue, find it very 
>> annoying that the elementwise operators are all are 2nd class citizens 
>> (i.e., you must use .*, ./, .+, .-, etc). The fact that the 1st class 
>> versions only work on a subset of arrays (i.e., those 1 and 2 dimensional) 
>> seems like a poor design choice to me. But this is different to the 
>> dripping dimensions indexed by scalars issue where there is still hope for 
>> a change.
>>
>> As a practical version of your function example in your second email is 
>> the plot command. You are plotting some slices from some higher dimensional 
>> arrays, e.g.
>>
>> plot(x[2,3,7,:,9], y[2,3,7,:,9])
>>
>> and you just want to get two one dimensional slices passed into plot with 
>> no fuss.
>>
>> Bob
>>
>>
>> On Wed, Apr 16, 2014 at 12:13 PM, Paweł Biernat <pawel....@gmail.com> 
>> wrote:
>>
>>> Adding a real life use case:
>>>
>>> x=[j+10*i for i=1:2, j=1:2]
>>>
>>> function f(x::Array{Int,1})
>>>     x
>>> end
>>>
>>> and then
>>>
>>> julia> f(x[1:2,1])
>>>
>>> 2-element Array{Int64,1}:
>>>  11
>>>  21
>>>
>>>
>>> julia> f(x[1,1:2])
>>> ERROR: no method f(Array{Int64,2})
>>>
>>>
>>>
>>

Reply via email to