function accumarray(subs, val, fun=sum, fillval=0; sz=maximum(subs,1), issparse=false)
counts = Dict()
for i = 1:size(subs,1)
counts[subs[i,:]]=[get(counts,subs[i,:],[]),val[i...]]
end
A = fillval*ones(sz...)
for j = keys(counts)
A[j...] = fun(counts[j])
end
issparse ? sparse(A) : A
end
It's not completely idiomatic, but it's pretty good and might be helpful.