up previous next
product

the product of the elements of a list

Syntax
product(L: LIST): OBJECT
product(L: LIST, InitVal: OBJECT): OBJECT

Description
This function returns the product of the objects in the list L (together with InitVal , if specified). When writing a program, if the list L may be empty, you must specify InitVal .

Example
/**/  Use R ::= QQ[x,y];
/**/  product([3, x, y^2]);
3*x*y^2

/**/  product(1..40) = factorial(40);
true

/**/  product([]);  -- gives 1 of type INT
1
/**/  product([], y);
y
/**/  product([3, x], y);
3*x*y

See Also