I am learning julia and i've just found this line:
if(any(mach_df[start_slot:(start_slot task_setup_time), Symbol(machine)].== 0))
What does it mean?, I know any is a function that returns true if every value of the parameter is true but I just can't understand what is inside the brakets.
Regards
CodePudding user response:
Let us work inside out:
mach_df[start_slot:(start_slot task_setup_time), Symbol(machine)]selects you rows from the rangestart_slot:(start_slot task_setup_time)and column namedSymbol(machine)(Symbolis most likely not needed, but I would need to see your source code to tell you exacly); as a result you get a vector.mach_df[start_slot:(start_slot task_setup_time), Symbol(machine)] .== 0gives you another vector that hastrueif the value in the LHS vector is0.- the
anypart will return true if any of the values in the vector produced above istrue.
A more advanced (and efficient) way to write it would be:
any(==(0), @view mach_df[start_slot:(start_slot task_setup_time), Symbol(machine)])
but I am not sure if you need performance in your use case.
