Creating Arrays - different behavior of *(a,b) and +(a,b) elements

Any[1 +(1,3)]

gives

1x2 Array{Any,2}:
 1  4

but

Any[1 *(1,3)]

have an

MethodError: `*` has no method matching *(::Int64, ::Tuple{Int64,Int64})
Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...)
  *(::Real, ::Complex{Bool})
  *(::Real, ::Complex{T<:Real})

why?

Parsing rules for separating elements of an array when hitting an operator depend on whether the operator is unary and whether it is followed by some white space. A unary operator followed by no white space is determined to declare a new element of the array while when it hits the binary operator it constructs a compound expression following normal rules.

1 Like