Array horizontal concatenation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Array horizontal concatenation

Anthony Ashley
Hello,

I noticed that implied hcat does not work if a space is omitted between the arrays to be concatenated. For example:

[[1 2][3 4]]

gives:

ERROR: MethodError: `typed_hcat` has no method matching typed_hcat(::Array{Int64,2}, ::Int64, ::Int64)
Closest candidates are:
  typed_hcat(::Type{T}, ::Number...)
  typed_hcat(::Type{T}, ::Any...)

while this works:

[[1 2] [3 4]]

Is this behavior intentional?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Array horizontal concatenation

Yichao Yu

On Oct 30, 2016 12:30 PM, "Anthony Ashley" <[hidden email]> wrote:
>
> Hello,
>
> I noticed that implied hcat does not work if a space is omitted between the arrays to be concatenated. For example:
>
> [[1 2][3 4]]
>
> gives:
>
> ERROR: MethodError: `typed_hcat` has no method matching typed_hcat(::Array{Int64,2}, ::Int64, ::Int64)
> Closest candidates are:
>   typed_hcat(::Type{T}, ::Number...)
>   typed_hcat(::Type{T}, ::Any...)
>
> while this works:
>
> [[1 2] [3 4]]
>
> Is this behavior intentional?

Yes

>
> Thanks!