[Shootout-list] Re: Fixed version of OCaml sumcol benchmark

Yaron Minsky yminsky@cs.cornell.edu
Thu, 10 Mar 2005 21:32:39 -0500


Actually, I apolgoize.  I'm just confused now.  Clearly, none of the
other entries takeany command line arguments at all.  The original
code looks like it works just fine.  Does anyone have any idea what
kind of failure is involved here?  A suspicious number of the sumcol
entries are marked as failed, not just OCaml.  I'm quite confused.

Yaron


On Thu, 10 Mar 2005 21:27:26 -0500, Yaron Minsky <yminsky@gmail.com> wrote:
> The OCaml sumcol benchmark assumes stdin, which appears to be wrong.
> Here's a fixed version:
> 
> let sum = ref 0
> let inchan = open_in Sys.argv.(1)
> let rec loop () = sum := !sum + int_of_string (input_line inchan); loop ();;
> try loop () with End_of_file -> Printf.printf "%d\n" !sum
>