I have defined a function f(x, y, z)
in Julia
and I want to parallely compute f
for many values of x
, holding y
and z
fixed. What is the "best practices" way to do this using pmap
?
It would be nice if it was something like pmap(f, x, y = 5, z = 8)
, which is how the apply
family handles fixed arguments in R
, but it doesn't appear to be as simple as that. I have devised solutions, but I find them inelegant and I doubt that they will generalize nicely for my purposes.
- I can wrap
f
in a functiong
whereg(x) = f(x, y = 5, z = 8)
. Then I simply callpmap(g, x)
. This is less parsimonious than I would like. - I can set 5 and 8 as default values for
y
andz
whenf
is defined and then callpmap(f, x)
. This makes me uncomfortable in the case where I want to fixy
at the value of some variablea
, wherea
has (for good reason) not been defined at the time thatf
is defined, but will be by the timef
is called. It works, but it kind of spooks me.