Character arithmetic

Affine character arithmetic is a system that defines addition and subtraction in certain cases involving character arguments. In this system, a number can be added to or subtracted from a character to give another character, and two characters can be subtracted to give a number. These are the same operations allowed in an affine space, and on types such as pointers. Character arithmetic was developed in BQN and subsequently included in Kap and Uiua. It independently appears in Julia, where it applies to characters only and not strings.

In K, characters are converted to numbers to participate in arithmetic. This system differs from affine character arithmetic in that it allows more operations, for example adding two characters together, and always returns a number, rather than determining the result type based on the input types.

Documentation

 * BQN, tutorial
 * Uiua (section "Character Arithmetic")