JuliaArrays / AxisArrays.jl

Performant arrays where each dimension can have a named axis with values
http://JuliaArrays.github.io/AxisArrays.jl/latest/
Other
200 stars 41 forks source link

Add more join methods to avoid confuse dispatch to fallback Base.join #158

Open gajomi opened 5 years ago

gajomi commented 5 years ago

Currently join dispatches on the typed positional arguments As::AxisArray{T,N,D,Ax}.... Every array must have the same parameters for this to be called. With

A = AxisArray(1:3,1:3)
B = AxisArray(0. + 1:3,2:4)

one gets

julia> join(A,B)
"1[1.0, 2.0, 3.0]2[1.0, 2.0, 3.0]3"
julia> @which join(A,B)
join(strings, delim) in Base at strings/io.jl:277

This is "correct" inasmuch as that is the behavior for AbstractArrays but is surprising for AxisArrays. If this behavior is intentional probably good to explicitly document. Alternatively, I would propose that additional methods for join be defined to handle in cases when the parameters of the the AxisArrays don't match.

Possible appropriate behaviors include:

Possible maybe appropriate behaviors include:

There are probably other options could be added to this list. Happy to hear thoughts on what makes sense here and implement if consensus on items.