Sum and product of an array: Difference between revisions

m
Line 519:
List.fold_left ( * ) 1 x;;
(* floats *)
let x = [1.0; 2.0; 3.0; 4.0; 5.0];;
List.fold_left (+.) 0.0 x;;
List.fold_left ( *.) 1.0 x;;</lang>
 
=={{header|Octave}}==
<lang octave>a = [ 1, 2, 3, 4, 5, 6 ];