Anonymous user
Jensen's Device: Difference between revisions
m
→{{header|OCaml}}
(added ocaml) |
|||
Line 109:
=={{header|OCaml}}==
{{trans|Python}}
<ocaml>let i = ref 42 (* initial value doesn't matter *)▼
▲let i = ref 42 (* initial value doesn't matter *)
let sum' ref_i lo hi term =
Line 124 ⟶ 123:
let () =
Printf.printf "%f\n" (sum' i 1 100 (fun () -> 1. /. float !i))</ocaml>
Output: 5.187378
|