# Instances for type

**URL:** <https://discourse.julialang.org/t/instances-for-type/80549>\
**Category:** New to Julia\
**Tags:** question, struct, base\
**Created:** [May 5, 2022, 2:47pm UTC](https://discourse.julialang.org/t/instances-for-type/80549 "2022-05-05T14:47:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamp](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vamp](https://discourse.julialang.org/u/vamp)\
**Post date:** [May 5, 2022, 2:47pm UTC](https://discourse.julialang.org/t/instances-for-type/80549/1 "2022-05-05T14:47:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 5, 2022, 2:52pm UTC](https://discourse.julialang.org/t/instances-for-type/80549/2 "2022-05-05T14:52:23Z")

</div>

Works fine for me.

```julia
julia> import Base: !

julia>

```

What are you doing and what is the exact error?

---

<div class="post-metadata">

**Author:** ![vamp](https://avatars.discourse-cdn.com/v4/letter/v/f4b2a3/32.png) [@vamp](https://discourse.julialang.org/u/vamp)\
**Post date:** [May 5, 2022, 2:55pm UTC](https://discourse.julialang.org/t/instances-for-type/80549/3 "2022-05-05T14:55:05Z")

</div>

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

> [@vamp](#):
>
> import Base: !

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [May 5, 2022, 3:00pm UTC](https://discourse.julialang.org/t/instances-for-type/80549/4 "2022-05-05T15:00:29Z")

</div>

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
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
julia> .![true, false, true]
3-element BitVector:
 0
 1
 0

```

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [May 5, 2022, 5:01pm UTC](https://discourse.julialang.org/t/instances-for-type/80549/5 "2022-05-05T17:01:48Z")

</div>

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:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
