# Why is that\`\`\`d = Dict("a"=&gt;1, "b"=&gt;2, "c"=&gt;3)filter!(d) do (k, v)

**URL:** <https://discourse.julialang.org/t/why-is-that-d-dict-a-gt-1-b-gt-2-c-gt-3-filter-d-do-k-v/54955>\
**Category:** General Usage\
**Created:** [February 9, 2021, 9:22pm UTC](https://discourse.julialang.org/t/why-is-that-d-dict-a-gt-1-b-gt-2-c-gt-3-filter-d-do-k-v/54955 "2021-02-09T21:22:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BridgeBot](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bridgebot/32/21491_2.png) [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Post date:** [February 9, 2021, 9:22pm UTC](https://discourse.julialang.org/t/why-is-that-d-dict-a-gt-1-b-gt-2-c-gt-3-filter-d-do-k-v/54955/1 "2021-02-09T21:22:20Z")

</div>

Why is that

```julia
d = Dict("a"=&gt;1, "b"=&gt;2, "c"=&gt;3)
filter!(d) do (k, v)
    iseven(v)
end

```

is happy, but

```julia
d = Dict("a"=&gt;1, "b"=&gt;2, "c"=&gt;3)
filter!((k,v) -&gt; iseven(v), d)

```

is sad and throws `ERROR: MethodError: no method matching (::var"#114#115")(::Pair{String,Int64})`? How am I doing this wrong?

Note that the original poster on Slack cannot see your response here on Discourse. Consider _transcribing the appropriate answer back to Slack_, or pinging the poster here on Discourse so they can _follow this thread_.  
[(Original message :slack:)](https://julialang.slack.com/archives/C6A044SQH/p1612904404416300?thread_ts=1612904404.416300&cid=C6A044SQH) [(More Info)](https://github.com/JuliaCommunity/SlackBridge)

---

<div class="post-metadata">

**Author:** ![tchr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tchr/32/15138_2.png) [@tchr](https://discourse.julialang.org/u/tchr)\
**Post date:** [February 9, 2021, 9:25pm UTC](https://discourse.julialang.org/t/why-is-that-d-dict-a-gt-1-b-gt-2-c-gt-3-filter-d-do-k-v/54955/2 "2021-02-09T21:25:14Z")

</div>

Quoting the answer from Frederik Ekre below:

> You need `filter(((k,v),) -> iseven(v), d)`

And more in-depth Q/A replies:

> Q: I had tried `((k,v))` but I didn’t realize I needed to turn it into a tuple.  
> A: `((k,v))` is just `(k,v)` just like `(1)` is just `1` .  
> A: `filter` gives you a single pair that you need to destruct, so you need to create a function that takes a single argument  
> Q: But why don’t I run into this with the `do` form?  
> A: `do (k, v)` is a single argument function while `do k, v` is a two argument function

EDIT: This issue is relevant [destructuring inconsistency with anonymous functions · Issue #36595 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/36595)
