# MethodError with @

**URL:** <https://discourse.julialang.org/t/methoderror-with/50131>\
**Category:** General Usage\
**Created:** [November 14, 2020, 5:50am UTC](https://discourse.julialang.org/t/methoderror-with/50131 "2020-11-14T05:50:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nebula](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nebula/32/18214_2.png) [@nebula](https://discourse.julialang.org/u/nebula)\
**Post date:** [November 14, 2020, 5:50am UTC](https://discourse.julialang.org/t/methoderror-with/50131/1 "2020-11-14T05:50:43Z")

</div>

I define a function with multiple parameters, but it throws a MethodError when @. is not the last parameter.  
Example:

```julia
julia> function f(x, y)
           println(x, y)
       end
f (generic function with 1 method)

julia> x = [1, 2, 3]
3-element Array{Int64,1}:
 1
 2
 3

julia> f(x, x.^2)
[1, 2, 3][1, 4, 9]

julia> f(x, @. x^2)
[1, 2, 3][1, 4, 9]

julia> f(x.^2, x)
[1, 4, 9][1, 2, 3]

julia> f(@. x^2, x)
ERROR: MethodError: no method matching f(::Tuple{Array{Int64,1},Array{Int64,1}})
Closest candidates are:
  f(::Any, ::Any) at REPL[1]:1
Stacktrace:
 [1] top-level scope at REPL[6]:1

```

Is this a bug?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 14, 2020, 6:14am UTC](https://discourse.julialang.org/t/methoderror-with/50131/2 "2020-11-14T06:14:35Z")

</div>

> [@nebula](#):
>
> `f(@. x^2, x)`

```julia
f(@.(x^2), x)

```

I agree it can be improved

---

<div class="post-metadata">

**Author:** ![nebula](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nebula/32/18214_2.png) [@nebula](https://discourse.julialang.org/u/nebula)\
**Post date:** [November 14, 2020, 6:31am UTC](https://discourse.julialang.org/t/methoderror-with/50131/3 "2020-11-14T06:31:15Z")

</div>

Thank you for your reply.  
It seems that parameters after @. are regarded as a tuple.  
Modified:

```julia
julia> f(@.(x^2), x)
[1, 4, 9][1, 2, 3]

julia> f((@. x^2), x)
[1, 4, 9][1, 2, 3]

```

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [November 14, 2020, 6:37am UTC](https://discourse.julialang.org/t/methoderror-with/50131/4 "2020-11-14T06:37:18Z")

</div>

I actually have an open issue about this: [https://github.com/JuliaLang/julia/issues/36547](https://github.com/JuliaLang/julia/issues/36547), it looks like it probably can’t change until 2.0, but if someone made a PR and rand PackageEval and nothing broke, it could be up for consideration before that.
