Skip to content
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

map!(f,dest::ChainedVector,src::AbstractArray) doesn't work for shorter src #115

Open
laborg opened this issue Dec 23, 2024 · 0 comments · May be fixed by #116
Open

map!(f,dest::ChainedVector,src::AbstractArray) doesn't work for shorter src #115

laborg opened this issue Dec 23, 2024 · 0 comments · May be fixed by #116

Comments

@laborg
Copy link
Contributor

laborg commented Dec 23, 2024

In case the src array is shorter an error is thrown:

julia> map!(i->-i,ChainedVector([[1,2,3]]),[10:11...])
ERROR: MethodError: no method matching getindex(::Nothing, ::Int64)
The function `getindex` exists, but no method is defined for this combination of argument types.
Stacktrace:
 [1] map!(f::var"#1#2", x::ChainedVector{Int64, Vector{Int64}}, A::Vector{Int64})
   @ SentinelArrays ~/.julia/packages/SentinelArrays/vt8A6/src/chainedvector.jl:781
 [2] top-level scope
   @ REPL[8]:1

This is due to the fact that the implementation iterates the destination array instead of the src array.

@laborg laborg changed the title map!(f,dest::ChainedVector,src::AbstractArray) doesnt work for shorter src` map!(f,dest::ChainedVector,src::AbstractArray) doesn't work for shorter src Dec 23, 2024
@laborg laborg linked a pull request Dec 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant