tBuLi/kingdon

Infix Operator discussion

Closed this issue · 2 comments

tBuLi commented

The number of infix operators available to us is limited, and therefore we must choose carefully. Additionally, we should try to be backwards compatible with popular libraries such as Clifford and ganja.js. Both of these use << for left-contraction, and ganja additionally defines >> for right-contraction. Furthermore, ganja.js uses >>> for conjugation, whereas Clifford does not seem to have a dedicated conjugation operator.

My first thought was to follow ganja.js's choice for contractions, but this means we do not have a dedicated conjugation operator because I still think that projection should be @. It just reads to nicely: x@y does indeed place x at y.

My proposal would be to use comparison < and > for left and right contractions, such that >> can be used for conjugation. Here are my reasons:

  • contraction is rarely used, whereas conjugation is extremely common. It therefore seems like a waste to sacrifice one of our prime operators for such a niche operation.
  • comparison is meaningless for GA's because they are not ordered (except the trivial real number case), and thus is is not very likely that we will ever need < and > in their usual sense.

If the use of comparisons for operators is really seen as a bridge to far, I would still propose >> for conjugation due to its similarity to what ganja.js does, and to just not have a dedicated infix operator for contractions. Users could instead use x.lc(y) when needed.

@enkimute, @arsenovic, input appreciated.

tBuLi commented

We will just use >> for conjugation, not sure about << yet but I'll leave it undefined for now. Comparison operators might be useful in the future so lets not do anything rash, especially since contractions are not used that often anyway so people can just use the inline notation a.lc(b).

tBuLi commented

Fixed in #21