Hmm…
Julia
A = rand(4, 8);
b = rand(8)';
c = rand(4);
D = @. exp(A ^ b) - log(c)
R
A <- matrix(runif(4*8), nrow = 4)
b <- t(runif(8))
c <- runif(4)
D <- exp(A ^ matrix(sapply(b, function(x) rep(x, 4)), nrow = 4)) - log(c)
EDIT: @qsong pointed out that this is a better way to write the last line:
D <- exp(A ^ rep(b, each = 4)) - log(c)
It gets worse as soon as you add (user defined?) functions that don’t have vectorized versions in R.
I’m presenting a 1-hour “Intro to Julia” session this Friday to a bunch of R users where I work.
Broadcasting was (and is) going to be one of my major selling points.