Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

left arrow operator in Julia

I have a vector

a = collect(1:4) 

What is the meaning of a <- a in Julia [result - false]

As per the documentation <- is not an assignment operator in Julia.

like image 628
Vinod Avatar asked Oct 17 '25 11:10

Vinod


1 Answers

Here is a way to check it (so that in the future you will be able to solve similar problems more easily):

julia> dump(:(a <- a))
Expr
  head: Symbol call
  args: Array{Any}((3,))
    1: Symbol <
    2: Symbol a
    3: Expr
      head: Symbol call
      args: Array{Any}((2,))
        1: Symbol -
        2: Symbol a

So as you can see a <- a is the same as a < (-a) thus you are comparing, using the < operator the a vector with the -a vector.

like image 144
Bogumił Kamiński Avatar answered Oct 20 '25 00:10

Bogumił Kamiński



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!