Hi everyone, I’m giving a first steps demonstration to some colleagues. However, I am not an expert in Julia. I wanted to show a simple example of distributed computing with Julia. This is the example that I want to show (original credit to Douglas Bates). However, the last line is broken. I can’t figure out how to fix it. The documentation says that the first argument to DArrays should be a “function that accepts a tuple of index ranges”.

```
using Distributions
using Distributed
using DistributedArrays
# addprocs(3)
##
@everywhere function gibbs(N, thin)
mat = Array{Float64,2}(undef, N, 2)
x = y = 0.0
for i = 1:N
for j = 1:thin
x = rand(Gamma(3.0, 1 / (y^2 + 4)))
y = rand(Normal(1 / (1 + x), 1 / (2 + 2x)))
end
mat[i, 1] = x
mat[i, 2] = y
end
mat
end
##
@time X = gibbs(500, 10_000)
##
dgibbs(N, thin) = DArray(I -> gibbs(map(length, I)[1], thin), (N, 2))
@time X = dgibbs(500, 10_000)
```