# Why does (sqrt ∘ +)(3,6) work but (√ ∘ +)(3,6) throws an error?

**URL:** <https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560>\
**Category:** New to Julia\
**Tags:** syntax\
**Created:** [March 4, 2023, 10:26pm UTC](https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560 "2023-03-04T22:26:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nayunis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nayunis/32/47408_2.png) [@Nayunis](https://discourse.julialang.org/u/Nayunis)\
**Post date:** [March 4, 2023, 10:26pm UTC](https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560/1 "2023-03-04T22:26:56Z")

</div>

I was just working my way through the Manual and got to the section about the composition operator. I wanted to try the example (sqrt ∘ +)(3,6) in my own jupyter notebook but used (√ ∘ +)(3,6) instead which throws the error:  
_error "syntax: “∘” is not a unary operator_

To me it is not clear why the first one one ((sqrt ∘ +)(3,6)) works but not the other one ((√ ∘ +)(3,6)). I thought sqrt and √ were meant to be equivalent.

I started learning Julia just a few days ago but as far as I can tell at this point, this is easily the most elegant language I’ve ever seen!! 😍 (I’m coming over from Matlab)

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [March 4, 2023, 10:32pm UTC](https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560/2 "2023-03-04T22:32:30Z")

</div>

In this case you have to use parentheses to disambiguate the meaning

```julia
julia> ((√) ∘ +)(3,6)
3.0

```

---

<div class="post-metadata">

**Author:** ![Nayunis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nayunis/32/47408_2.png) [@Nayunis](https://discourse.julialang.org/u/Nayunis)\
**Post date:** [March 4, 2023, 10:42pm UTC](https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560/3 "2023-03-04T22:42:01Z")

</div>

I see! But then why does the + not have to be in brackets?

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [March 4, 2023, 10:55pm UTC](https://discourse.julialang.org/t/why-does-sqrt-3-6-work-but-3-6-throws-an-error/95560/4 "2023-03-04T22:55:12Z")

</div>

`√` is one of a small number of unary operators `+ - ! ~ ¬ √ ∛ ∜ ⋆ ± ∓` that require the parentheses in that position. You’re trying to just refer to the function `√`, not use that as an operator.

I _think_ what’s happening is that the parser is trying to interpret it as `√(∘(+(3,6)))` which doesn’t make sense so it errors.

There’s no ambiguity in the case on the right, so it doesn’t need parentheses. eg you can do

```julia
julia> ((√) ∘ √)(3)
1.3160740129524924

```
