Instances for type

How to import Base: ! when I get no method matching !??

Works fine for me.

julia> import Base: !


What are you doing and what is the exact error?

I get ERROR: MethodError: no method matching !(::Vector......... so I want to know how wan I solve it with

Importing the function from Base won’t help. It is already imported by default.

! means logical negation. It is not defined for vectors. What is it supposed to return on a vector, e.g what should ![1,2,3] be?

Base defines it for booleans, functions and missing values:

julia> methods(!)
# 3 methods for generic function "!":
[1] !(f::Function) in Base at operators.jl:1117
[2] !(x::Bool) in Base at bool.jl:35
[3] !(::Missing) in Base at missing.jl:101

You can use broadcasting . to negate a vector of booleans for example

julia> .![true, false, true]
3-element BitVector:

When you get an error message, you must show all the code you ran to get that error.

Since the error message mentions Vector, clearly you did something after import Base: ! that triggered the error. That is the important part to show.

This is a useful post to consult when asking questions: