We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
findall(A)
1 parent c5b5a76 commit 8d5efbbCopy full SHA for 8d5efbb
base/array.jl
@@ -2324,7 +2324,9 @@ julia> findall(falses(3))
2324
Int64[]
2325
```
2326
"""
2327
-findall(A) = findall(identity, A)
+function findall(A)
2328
+ collect(first(p) for p in pairs(A) if last(p))
2329
+end
2330
2331
# Allocating result upfront is faster (possible only when collection can be iterated twice)
2332
function findall(A::AbstractArray{Bool})
test/arrayops.jl
@@ -594,6 +594,10 @@ end
594
@test findprev(b, T(1)) isa keytype(b)
595
@test findprev(b, T(2)) isa keytype(b)
596
end
597
+
598
+ @testset "issue 43078" begin
599
+ @test_throws TypeError findall([1])
600
+ end
601
602
@testset "find with Matrix" begin
603
A = [1 2 0; 3 4 0]
0 commit comments