Elementwise comparison of Arrays yield a x-element BitArray{1} with zeros instead of Bool

Is this a known and desirable result?
I just tested this in in v"1.1.0" and the result is a Bool.
From the Doc (v1.2): “Note that comparisons such as == operate on whole arrays, giving a single boolean answer. Use dot operators like .== for elementwise comparisons. (For comparison operations like < , only the elementwise .< version is applicable to arrays.)”

Julia v"1.2.0"

log.([1]) .< 0
> 1-element BitArray{1}:
> 0

log.([1; 1]) .< 0
> 2-element BitArray{1}:
> 0
> 0

log.([1, 1]) .< 0
> 2-element BitArray{1}:
> 0
> 0

[1, 1] .< [2, 2]
> 2-element BitArray{1}
> 1
> 1

whereas

log.((1, 1)) .< 0
> (false, false)

log.(1) .< 0
> false
1 Like

The elements are boolean. In Julia, Bool is a subtype of Number with true == 1 and false == 0. When you print a whole array of boolean values (e.g. a BitArray), the elements simply print as 0 and 1 in Julia 1.2, rather than as true and false, for legibility and compactness.

julia> b = BitArray([true, false, true, true, false])
5-element BitArray{1}:
 1
 0
 1
 1
 0

julia> b[2]
false
2 Likes

Nice!
I couldn’t find anything in the release notes or in the documentary, thanks for that!