Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Great Programming Language Shootout Revived
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yaron Minsky <yminsky@g...>
Subject: Re: [Caml-list] Great Programming Language Shootout Revived
On Thu, 17 Jun 2004 13:05:12 -0500 (CDT), Brian Hurt <bhurt@spnz.org> wrote:

> What's starting to happen, now that the project has started up again, is
> advocates/supporters of other languages have started to submit improved
> versions of the code for their languages.  For example, I notice that
> Ocaml has dropped from it's #1 place in least lines of code to #2, with
> Ruby taking the lead.

For what it's worth, the ocaml line-counts in the shootout are
particularly bogus.  There are lots of examples where the ocaml code
does things like putting entire for loops (or even nested for loops!)
on a single line.  Here's an example:

let _ =
  let n = if Array.length Sys.argv > 1 then int_of_string Sys.argv.(1) else 1 in
  let lix = n - 1 and x = Array.make n 0 and y = Array.make n 0 in
  for i = 0 to lix do x.(i) <- i + 1 done;
  for k = 0 to 999 do for i = lix downto 0 do y.(i) <- x.(i) + y.(i) done done;
  Printf.printf "%d %d\n" y.(0) y.(lix)

The code is perfectly reasonable, but it would be a hell of a lot more
readable and idiomatic if it was on 16 lines instead of 6.  The other
languages in the shootout appear to engage in less of this tomfoolery.
 Personally, I think the ocaml entries should be fixed to have more
lines of code.  As it is, the examples make ocaml look much more
obscure that it is.

y

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners