Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

findfirst doesn't work for infranges with negative step sizes #180

Closed
DanielVandH opened this issue Jun 17, 2024 · 0 comments · Fixed by #192
Closed

findfirst doesn't work for infranges with negative step sizes #180

DanielVandH opened this issue Jun 17, 2024 · 0 comments · Fixed by #192

Comments

@DanielVandH
Copy link
Contributor

julia> using InfiniteArrays

julia> findfirst(==(9), 10:-1:-∞)

julia> findfirst(==(11), 10:-1:-∞)
0

julia> findfirst(==(21), 10:-1:-∞)
-10

julia> (10:-1:-∞)[-10]
ERROR: BoundsError: attempt to access ℵ₀-element InfiniteArrays.InfStepRange{Int64, Int64} with indices OneToInf() at index [-10]
Stacktrace:
 [1] throw_boundserror(A::InfiniteArrays.InfStepRange{Int64, Int64}, I::Int64)
   @ Base .\abstractarray.jl:737
 [2] getindex(v::InfiniteArrays.InfStepRange{Int64, Int64}, i::Int64)
   @ InfiniteArrays C:\Users\User\.julia\packages\InfiniteArrays\heAfT\src\infrange.jl:213
 [3] top-level scope
   @ REPL[18]:1
@DanielVandH DanielVandH changed the title findfirst doesn't work for ranges with negative step sizes findfirst doesn't work for infranges with negative step sizes Jun 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant