For hcat, what shape would you want the output to have?

With your example input, the result of vcat is straightforward:

v = [[1],[2,3],[4,5]]
vcat(v...)
# -> [1, 2, 3, 4, 5]

But for hcat, what output would you want? hcat(v...) throws a 
DimensionMismatch error stating that vectors must have the same length.
//T

On Friday, November 27, 2015 at 1:39:34 PM UTC+1, Cedric St-Jean wrote:

foldl would work, but it's going to create a ton of temporary arrays.
>
> None of the proposed efficient solutions work with hcat... I suppose if 
> splatting is a problem I should allocate and fill in the array myself.
>
> On Friday, November 27, 2015 at 6:39:07 AM UTC-5, Glen O wrote:
>>
>> Any chance that foldl(vcat,arr_of_arr) will do the job?
>>
>> On Sunday, 22 November 2015 23:04:26 UTC+10, Cedric St-Jean wrote:
>>>
>>> I have a big vector of vectors. Is there any way to vcat/hcat them 
>>> without splatting?
>>>
>>> arr_of_arr = Vector[[1],[2,3],[4,5]]
>>> vcat(arr_of_arr...)
>>>
>>> I'm asking because splatting big arrays is a performance issue (and IIRC 
>>> it blows the stack at some point).
>>>
>> ​

Reply via email to