(* * $Id: sumcol.ocaml,v 1.6 2001/01/14 15:26:28 doug Exp $ * http://www.bagley.org/~doug/shootout/ * from Markus Mottl *) let sum = ref 0 let rec loop () = sum := !sum + read_int (); loop () let _ = try loop () with End_of_file -> Printf.printf "%d\n" !sum