Skip to content

Fix map mini piracy #958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/array/methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ end
- There are less problems with type stability in `map` as we can just
take dims from the first, there are no length 1 dims.
=#
function Base.map(f, As::AbstractDimArray...)
comparedims(As...)
newdata = map(f, map(parent, As)...)
rebuild(first(As); data=newdata)
function Base.map(f, A1::AbstractDimArray, As::AbstractDimArray...)
comparedims(A1, As...)
newdata = map(f, map(parent, (A1, As...))...)
return rebuild(A1; data=newdata)
end


Expand Down
4 changes: 0 additions & 4 deletions src/stack/stack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ function Base.merge(
merge(map(layers, (x1, x2, x3, xs...))...)
end

Base.map(f, s::AbstractDimStack) = error("Use maplayers(f, stack)) instead of map(f, stack)")
Base.map(f, ::Union{AbstractDimStack,NamedTuple}, xs::Union{AbstractDimStack,NamedTuple}...) =
error("Use maplayers(f, stack, args...)) instead of map(f, stack, args...)")

maplayers(f, s::AbstractDimStack) =
_maybestack(s, unrolled_map(f, values(s)))
function maplayers(
Expand Down
Loading