Behavior of \circ<tab>

Inside “manual/functions” under “Function composition and piping”, the first example of using \circ<tab> is

julia> (sqrt \circ<tab> +)(3, 6)

which evaluates to 3.0. However, when I try to do the same thing with \sqrt<tab> instead of just sqrt, it gives an error “\circ<tab> not a unary operator”. Like this:

julia> (\sqrt<tab> \circ<tab> +)(3, 6)

Can somebody explain to me why that is, please? I can’t figure it out, as I’m not familiar enough with the overall language yet.

Thanks in advance!

I think it’s because \sqrt is a prefix operator, not a normal function, so it has a different parsing precedence. But ((\sqrt<tab>) \circ<tab> +)(3, 6) works fine.

3 Likes

That seems to be the reason, thank you! It also explains this:

julia> sqrt == \sqrt<tab> 
true

but

julia> \sqrt<tab> == sqrt
== not a unary operator
2 Likes