JuliaData / JuliaData/SentinelArrays.jl
`map!(f,dest::ChainedVector,src::AbstractArray)` doesn't work for shorter `src`
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 22
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported shorter-src example and inspect sentinelarrays.jl:781, where map! is shown in the stack trace. Confirm the failure for a shorter src and verify that the same call completes without a MethodError after the destination and source lengths are handled as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100