# Add composition operator ⨟ Unicode 2A1F for flipped ∘

Dear Julia designers,

having read parts of the Applied Category Book Seven Sketches of Compositionality by Brendan Fong and David I. Spivak I really appreciate the use of the \fatsemi operator ⨟

It is just the reversed \circ ∘ function composition operator which is much more inuitive in many situations, because it rather mirrors how you would construct pipelines.

Unfortunately the character is not recognized by julia currently but instead if you try to assign to it you get the following error (julia 1.3.1)

ERROR: syntax: invalid character "⨟" near column 2


My suggestion is to add this character to valid characters and define it as the flipped function composition.

f ⨟ g = g ∘ f

4 Likes

My browser doesn’t even display the symbol…

1 Like

I like how this operator symbol is made up of ∘ for composition and ; which runs stuff in the left to right order.

1 Like

This is great! Here is a PR to add this https://github.com/JuliaLang/julia/pull/34722

Beautiful

4 Likes

IS this operator used anywhere besides in that book? I’ve never seen it before

in what way does ; run stuff left to right? As far as I know it suppresses output, delimits vectors and expressions in julia.

Yeah you are of course right. What I wanted to say is that composition is executed_second ∘ executed_first. While we have executed_first; executed_second.

Another option that already works is to define this on \circ with a unicode modifier, i.e. ∘̂ (typed \circ<TAB>\hat<TAB>):

julia> ∘̂(f, g) = g ∘ f
∘̂ (generic function with 1 method)

julia> (sin ∘̂ cos)(1)
0.6663667453928805

julia> (cos ∘ sin)(1)
0.6663667453928805

help?> ∘̂
"∘̂" can be typed by \circ<tab>\hat<tab>

search: ∘̂

No documentation found.

∘̂ is a Function.

# 1 method for generic function "∘̂":
[1] ∘̂(f, g) in Main at REPL[25]:1


In https://github.com/JuliaLang/julia/pull/34722 I added \fatsemi<TAB> completion. But I just realized that ⨟ almost looks like the “blackboard font” version of ; so maybe \bb;<TAB> (like \bbX<TAB> expands to 𝕏) also makes sense?

1 Like

I think it is really decisive for intuitive readability and semantics that the \fatsemi has \circ as part of it. Hence I wouldn’t go for the “filled” blackboard font version.

I’m not sure if I understand what you are talking about. My comment on \bb; was about how this character is entered in the REPL. More precisely the addition of this line in the PR:

I’m not changing the character itself. (OK, right now I’m suggesting to use ⨾ (U+2A3E) instead of ⨟ (U+2A1F) in the PR but that look pretty much identical to me in my browser.)

My misunderstanding. Thanks for pointing out that it is actually the same symbol (which unicode version or whether both will be best decided in the pullrequest).

For better autocompletion \fatsemi is very nice to have. For those who know the \bb family, I guess that one is more self-explanatory (haven’t used that so far). Would go with both or if only one is required, prefer \fatsemi

2 Likes