calling fun.()
below returns an Array
of NamedTuple
s:
julia> function fun(x)::NamedTuple
(a = x + 1, b = x - 1)
end
fun (generic function with 1 method)
julia> fun.([1, 2, 3])
3-element Array{NamedTuple{(:a, :b),Tuple{Int64,Int64}},1}:
(a = 2, b = 0)
(a = 3, b = 1)
(a = 4, b = 2)
however, I want the output to be:
(a = [2, 3, 4], b = [0, 1, 2])
i.e., a NamedTuple
of Array
s
of course I could manipulate the returns from fun.
, but is there a direct way to control the output of “dot” functions?
thanks.