Skip to content

replace[!]() with count is broken #112

@laborg

Description

@laborg

replace as well as replace! do not work properly if count is supplied:

julia> replace(ChainedVector([[1,2],[1,2]]), 2=>20; count=1)
6-element ChainedVector{Int64, Vector{Int64}}:
  1
 20
  1
 20

julia> replace([1,2,1,2],1=>20,count=1) # expectation
4-element Vector{Int64}:
 20
  2
  1
  2

The underlying code just applies the count limitation to each chunk.

Sprinkeling @inbounds on the array get/setindex didn't improve performance, but I should probably add it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions