Skip to content

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

Open
@laborg

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions