Assigning a function to unicode symbols

I tried to assign a function to a unicode symbol and found out that while this works for most supported unicode symbols it fails for some.
specifically, you can see that Julia seems to be picky regarding assignment of \triangleleft :

julia> ⊲ = sin # \vartriangleleft
sin (generic function with 12 methods)

julia> ⊳ = sin # \vartriangleright
sin (generic function with 12 methods)

julia> ▷ = sin # \triangleright
sin (generic function with 12 methods)

julia> ◁ = sin # \triangleleft
ERROR: syntax: invalid character "◁" near column 2
Stacktrace:
 [1] top-level scope at REPL[7]:0

Is there some logic behind this? and if so, is there a list of symbols which can be used?

1 Like

The list (in source code) is here. ‘◁’ (\triangleleft) is omitted. As ‘▷’ (\triangleright) is included, I expect this was originally an oversight. However see #30658 where it is suggested that this character be used as single character pipe operator.

I concur that having both of a operator/relation glyph pair is better than having only one of them.

2 Likes