How to define a new infix operator?

see in base\operators.jl that the built-in operators are defined concisely like:

<(x, y) = isless(x, y)

however, seems like I can’t define a custom infix operator like:

julia> (α)(x, y) = x + y
α (generic function with 1 method)

julia> α(1, 2)
3

julia> 1 α 2
ERROR: syntax: extra token "α" after end of expression

so, is it possible to have custom infix operators? if yes, what is the syntax of such definitions? thanks.

1 Like

There are a bunch of discussions on this, see e.g. here: ★ is not an operator - #2 by Sukera

5 Likes