up previous next
the product of the elements of a list
product(L: LIST): OBJECT
product(L: LIST, InitVal: OBJECT): OBJECT |
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
.
/**/ 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
|