7.3.7.2 n-ary Functions

SUM['(' index '=' start [':' end] ')' ] '{' <expression> [',' <expression>]'}'

MUL['(' index '=' start [':' end] ')' ] '{' <expression> [',' <expression>]'}'

MIN['(' index '=' start [':' end] ')' ] '{' <expression> [',' <expression>]'}'

MAX['(' index '=' start [':' end] ')' ] '{' <expression> [',' <expression>]'}'

Note: when you use an index variable in n-ary functions, you can use the count-operator # to count the appearances of substituted indices. The count-operator can only be used within one expression, that means that #i has no value when used in a following statement.

LET sum : #i*SUM(i=1:5){Vector[i]}

would be equivalent to

LET sum = *SUM{Vector[1],Vector[2],Vector[3],Vector[4],Vector[5]}

would be equivalent to

To make such a substitution explicitly, we use the modified assignment operator ':' instead of the '=' assignment operator in our LET or SET statements. If such a statement is encountered, CSI(C&F) scans the data space for all instanciated Vector[i] objects, and inserts them in the expression list of this n-ary function. In the same step #i is incremented. The start and end condition (i=1:5) are optional and can be used in much the same way as in a FOR - NEXT loop.

Note that you can state a search condition without upper bound, as e.g.,

LET m : MIN(i=4){Vector[i]}.

This would be equivalent to the statement

LET m = MIN{Vector[4],Vector[5]}

if we assume that no variable Vector[i] exists with i>5.