Hi, I have a function with local variable, which I want to apply for each element in an array, in parallel manner. I am using ThreadTools library.
Assuming following code
using ThreadTools
do_it(a, b, c, d) = a + b * c + d
function try_it()
b=5
c=6
d=7
# following code works as expected
tmap(x->do_it(x, b, c, d), [1, 2, 3, 4])
# but I want to do this, so I don't have to pass the variables which are not changing here explicitly
do_it(a) = do_it(a, b, c, d)
tmap(do_it, [1, 2, 3, 4])
end
Generally, if there is any way how to get the passing b, c, d out of the tmap, so the code would be more readable, Iām for it.