Fastest way to negate some booleans in an array

If you have no problem in writing some extra lines:

julia> function negateAllEvenIndexes(A)
           for i in 2:2:length(A)
               A[i] = !A[i]
           end
           A
       end
julia> @btime negateAllEvenIndexes($A)
  31.877 ms (0 allocations: 0 bytes)
1 Like