https://gitorious.org/ocamlp3l/ocamlp3l_cvs.git
Tip revision: 2db189928c94d62a3b4757b3eec68f0a4d4113f0 authored by dicosmo on 23 June 1998, 11:28:44 UTC
*** empty log message ***
*** empty log message ***
Tip revision: 2db1899
simplefarm.ml
(* program computing a function over a stream of floats ...
by using a farm (very simple!) *)
let farm_worker x =
x *. x;;
let nothing _ = ();;
let generate_input_stream =
let x = ref 0.0 in
(function () ->
begin
x := !x +. 1.0;
if(!x < 10.0) then !x else raise End_of_file
end);;
let print_result x =
print_float x; print_newline();;
let program ()=
startstop
(generate_input_stream, nothing)
(print_result,nothing,nothing)
(farm(seq(farm_worker),4))
in
pardo program
;;