Jump to content

Jensen's Device: Difference between revisions

m
(added ocaml)
Line 109:
=={{header|OCaml}}==
{{trans|Python}}
<ocaml>let i = ref 42 (* initial value doesn't matter *)
<pre>
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>
</pre>
Output: 5.187378
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.