Skip to content

Commit

Permalink
ambiguite fix dimnames
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Dec 12, 2024
1 parent f366521 commit 00414a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/abstractnamedunitrange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Base.last(i::AbstractNamedUnitRange) = last(unname(i))
Base.length(i::AbstractNamedUnitRange) = named(length(unname(i)), name(i))

# TODO: Use `isnamed` trait?
dimnames(a::Tuple{Vararg{AbstractNamedUnitRange}}) = name.(a)
dimnames(a::Tuple{AbstractNamedUnitRange,Vararg{AbstractNamedUnitRange}}) = name.(a)
dimnames(::Tuple{}) = ()

unname(a::Tuple{Vararg{AbstractNamedUnitRange}}) = unname.(a)
unname(a::Tuple{Vararg{AbstractNamedUnitRange}}, names) = unname(align(a, names))
Expand Down
2 changes: 1 addition & 1 deletion src/namedint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name(i::NamedInt) = i.name
named(i::Integer, name) = NamedInt(i, name)

# TODO: Use `isnamed` trait?
dimnames(a::Tuple{Vararg{AbstractNamedInt}}) = name.(a)
dimnames(a::Tuple{AbstractNamedInt,Vararg{AbstractNamedInt}}) = name.(a)

function get_name_perm(a::Tuple{AbstractNamedInt,Vararg{AbstractNamedInt}}, names::Tuple)
return getperm(dimnames(a), names)
Expand Down

0 comments on commit 00414a6

Please sign in to comment.