I was writing a function for boolean 2d arrays:
function foo(A::Array{Bool,2})
...
end
Evaluating and testing it with
A = randbool(3,3)
foo(A)
returns
ERROR: 'foo' has no method matching foo(::BitArray{2})
Obviously, randbool()
generates a BitArray
, whereas I assumed randbool()
would yield an Array{Bool}
.
How are Array{Bool}
and BitArray
related? Why do they both exist?
Can I write foo()
in such a way that it accept both input types using a single method (since I can't see a difference)?