Infix functions are functions that work like operators. That is, the name of the function goes between its two
arguments, just as the
* symbol goes between the two values to be multiplied. In fact, an operator
and an infix function are really two different names for the same thing. You can create an operator, therefore, by
defining an infix function.
Here is an example of an infix function that calculates the distance between two points. It uses the symbol
>>> to represent the concept of distance. The points are represented by records.
import "omfloat.xmd" unprefixed import "omtrig.xmd" unprefixed declare record point field float x field float y define float infix-function value point a >>> value point b as return hypot (a:x - b:x, a:y - b:y) process local point Ghent local point Aix set Ghent:x to 137.5 set Ghent:y to 83.2 set Aix:x to 219.7 set Aix:y to 345.9 output "d" % Ghent >>> Aix