Skip to content

Commit fa04978

Browse files
committed
eachslice with 1.9 semantics
1 parent c1b3e15 commit fa04978

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/functions.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ function Base.permutedims(A::KeyedArray, perm)
9494
KeyedArray(data, new_keys)#, copy(A.meta))
9595
end
9696

97-
if VERSION >= v"1.1"
97+
@static if VERSION > v"1.9-DEV"
98+
function Base.eachslice(A::KeyedArray; dims)
99+
dims_ix = AxisKeys.dim(A, dims) |> Tuple
100+
data = @invoke eachslice(A::AbstractArray; dims=dims_ix)
101+
return KeyedArray(NamedDimsArray(data, map(d -> dimnames(A, d), dims_ix)), map(d -> axiskeys(A, d), dims_ix))
102+
end
103+
elseif VERSION >= v"1.1"
98104
# This copies the implementation from Base, except with numerical_dims:
99105
@inline function Base.eachslice(A::KeyedArray; dims)
100106
numerical_dims = NamedDims.dim(A, dims)

0 commit comments

Comments
 (0)