From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA25265; Tue, 15 Oct 2002 13:00:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA25272 for caml-list@pauillac.inria.fr; Tue, 15 Oct 2002 13:00:19 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA21140 for ; Tue, 15 Oct 2002 11:28:35 +0200 (MET DST) Received: from mail.interaktif.net.tr ([62.248.102.120]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g9F9SV523308; Tue, 15 Oct 2002 11:28:32 +0200 (MET DST) Received: from abn166-176.ank-avrupa-ports.kablonet.net.tr (unknown [195.174.166.176]) by mail.interaktif.net.tr (Postfix) with ESMTP id 308E01E6CB; Tue, 15 Oct 2002 12:25:32 +0300 (EEST) From: Eray Ozkural Organization: Bilkent University CS Dept. To: Xavier Leroy , Oleg Subject: Re: [Caml-list] productivity improvement Date: Tue, 15 Oct 2002 12:24:47 +0300 User-Agent: KMail/1.4.5 Cc: Emmanuel Renieris , caml-list@inria.fr References: <20020716172916.4903.qmail@web10702.mail.yahoo.com> <200207190956.FAA29574@dewberry.cc.columbia.edu> <20020719131039.A30060@pauillac.inria.fr> In-Reply-To: <20020719131039.A30060@pauillac.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200210151224.47272.erayo@cs.bilkent.edu.tr> Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Friday 19 July 2002 14:10, Xavier Leroy wrote: > > Determine Dr. Leroy's involvement in JFK assassination 180 > > Should take less time than this, given that I wasn't born at that time :-) > > As everyone else, I'll point out that your code can be shortened and > made more readable by judicious use of printf and regexps (see below). > But really, if this is the kind of programs you're interested in > (text-based I/O with no data structures), forget about C++ and Caml, > and use Perl. > Definitely so. Also "portage" from C/C++ cannot automatically result in a productivity enhancement for obvious reasons. A straightforward port will preserve the painstaking style of those languages. For truly enhancing the quality of code the first step I take is to design the program to benefit from the higher level of abstraction and modularity modern functional languages provide for. Especially using generic data types work very well. In ocaml you can really write algorithms that work on generic structures, which is good for cutting down code size and getting to the point. Using the module system, one can clearly decompose the code into interfaces and implementations... For instance in a stock market prediction code I have been working on, it took no more than a couple of days to rewrite a large portion of the code in Haskell that was previously written in C. The resulting code was significantly shorter and more modular; allowing me to play with new algorithms / metrics easily. The same would not be the case with C++. (The code isn't too Haskell specific and could be done as well in ocaml) That code I think went down from about 2500 lines to 500 lines which isn't bad. To attain that kind of improvement, you need a change in style. The C program apparently used lots of text I/O to transfer and store data between modules. The Haskell program didn't have to. It is also true that it is not correct to expect such improvements in code that is too simple. If all you want to do is to sum over an array of integers, you can do it in C easily. -- Eray Ozkural Comp. Sci. Dept., Bilkent University, Ankara www: http://www.cs.bilkent.edu.tr/~erayo GPG public key fingerprint: 360C 852F 88B0 A745 F31B EA0F 7C07 AE16 874D 539C ------------------- 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