Hacker News new | ask | show | jobs
by forgotpwd16 1252 days ago
>No multiplication by juxtaposition

That's possible albeit limited.

  julia> x=[1,2]
  2-element Array{Int64,1}:
   1
   2

  julia> 2x
  2-element Array{Int64,1}:
   2
   4

  julia> 2(x+x)
  2-element Array{Int64,1}:
   4
   8

  julia> x=2
  2

  julia> [1,2]x
  2-element Array{Int64,1}:
   2
   4
but, as mentioned, due to element access the inverse (x[1,2]) cannot work. Neither can multiply variables that way.
1 comments

I forgot that Julia can do juxtaposition multiplication with literal prefixes. (My guess is symbols that can't begin an identifier.) Otherwise, the types of the terms must be known at parse-time to correctly interpret, for example, f(x)².