% $Id: Product.oz,v 1.2 2008/01/05 19:56:26 leavens Exp leavens $ declare %% Return the product of the numbers in the argument list %% Fully recursive version, not iterative due to pending computations fun {Product Ls} case Ls of E|Es then E*{Product Es} else 1 end end %% Return the product of the numbers in the argument list %% Tail recursive version, iterative, no pending computations fun {ProductI Ls} fun {ProductIter Ls R} case Ls of E|Es then {ProductIter Es E*R} else R end end in {ProductIter Ls 1} end