lt()

the predicate “less than” function

Synopsis

lt(x1, x2)

Description

Numeric comparison equivalent to the infix form x1 < x2.

Parameters

  • x1numeric-expression

    left-hand argument.

  • x2numeric-expression

    right-hand argument.

Returns

Returns 1 if x1 is less than x2, 0 otherwise.

Examples

Agents with an age less than 18 can be filtered into the state Select with the transition rule:

if (lt(age, 18)) then next(Select)

or with the infix form:

if (age<18) then next(Select)

Errors

To use a numeric comparison operator within an expression, you must use the functional version of the operator. For example:

x = x + lt(age, 10)  # adds 1 to x if age < 10
x = x + (age < 10)  # will result in a fred_compiler error message.

See Also

lte(), gt(), gte(), eq(), equal(), neq()