Consider:
foo(v) = [x + 5 for x in v]
I think that in most cases if foo
is called with a scalar, one wants a scalar value back, equivalent to foo(v) = v + 5
. However, this function results in
julia> foo(5)
0-dimensional Array{Int64,0}:
10
which is type stable when v
is an array, but not exactly what we want.
Is there a reason that a zero-dimensional array exists? How is it different from a scalar?