Skip to content

Incorrect filtering of subarrays #4763

Closed
@magistere

Description

filter produces incorrect output for subarrays:

julia> a = [1:10]
10-element Array{Int32,1}:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10

julia> b = sub(a, 5:8)
4-element SubArray{Int32,1,Array{Int32,1},(Range1{Int32},)}:
 5
 6
 7
 8

julia> filter(x -> x < 7, b)
4-element Array{Int32,1}:
 5
 5
 4
 4

julia> filter(x -> x < 7, b[:])
2-element Array{Int32,1}:
 5
 6

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