I’m attempting to learn a new package and there is an operation being performed on two arrays in the example code that I don’t understand:
+(yth[3:end], ysh...)
yth is of type Array{Float64,1} and ysh is of type Array{Array{Float64,1},1}. Specifically, I don’t understand what the + sign before the opening parenthesis does, and I don’t understand the ... that follows ysh. I see that ysh is an array of arrays, and the operation above results in a single array being returned, so I’m assuming it’s simply summing all of the values, but I don’t quite understand how it’s happening via this syntax.
I created the following example to try to understand, but I’m not seeing it:
I think @PetrKryslUSD said this already, but I thought it might help to have it explained a different way: 1+2 is “lowered” to +(1,2). The + operator is a function, just like any other function. And, just like any other function, you can pass any iterable object as multiple arguments of a function using .... So 1+2+3 == +(1,[2,3]...)
Thank you all very much!! I understand it now! The way I’m thinking about this is that the ... operator ‘decomposes’ or breaks down the array of arrays…