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 KAA31168; Wed, 24 Jul 2002 10:00:29 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA31173 for ; Wed, 24 Jul 2002 10:00:29 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a124.tin.it [62.211.4.124]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6O80RX26419 for ; Wed, 24 Jul 2002 10:00:27 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id AF9332724B; Wed, 24 Jul 2002 10:07:53 +0200 (CEST) Message-ID: <3D3E6059.80802@baretta.com> Date: Wed, 24 Jul 2002 10:07:53 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: it, en MIME-Version: 1.0 To: Oleg , Ocaml Subject: Re: [Caml-list] Rule based language [was: productivity improvement] References: <20020716172916.4903.qmail@web10702.mail.yahoo.com> <200207210059.UAA17003@dewberry.cc.columbia.edu> <3D3AB082.2080503@baretta.com> <200207230951.FAA15922@dewberry.cc.columbia.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Oleg wrote: >>197 lines of code, including whitespace and commments. I >>think it is a pretty clear example of how you can write cool >>software in O'Caml in a very short time. If you had not been >>"lazy", as you said, and had tried implementing the same >>language in C++, I strongly doubt you could have written a >>more compact source. > > > > 109 LOC in C++ counting blank lines and lines containing a single '}'. See > atttached files. Cool job Oleg! Hats off to you. > A few notes about the differences between your O'Caml program and my C++ > program: > > 1) I'm not using Yacc or Lex for parsing, because I'm not familiar with these > tools, so ugly parsing takes up most of those 109 LOC (Parsing things is > peripheral to my professional interests right now. I don't write compilers) I expected it to be so. > 2) I decided not to implement the "simple" keyword, because I did not > understand what it was supposed to mean (a depth limit on deduction, I'm > guessing, but what for?) Not a big deal. > 3) Your program fails to imlement multi-token post-conditions in rules and > mutli-token goals (as described in your formal language specification) I don't remember. I lost the original specs and I finished working on that program more than a year ago. I look at it again today if I have time. Otherwise I'll, think intensely about parsing and backtracking, under the Salentinian sun, on the white sand of the beaches of Alimini. > 4) The algorithms are different I think, resulting in, for example, about > 200x speed improvement for the attached test.input file on my P3-800MHz > (g++-3.0 vs ocamlopt) (The output is identical). The O'Caml program > convergence seems to be quite unstable. Sometimes it is as fast or even > faster than the C++ program. I take this to mean you are challenging me, huh? You are, huh? Ok... Ok, you'll see... ;-) > I can see how the same algorithm can be implemented in ~100 LOC of O'Caml > too. However, IMO as this and the previous examples show, reports about > extreme LOC ratios are premature. > > Cheers, > Oleg I had only a modest O'Caml experience 14 months ago, when I wrote the code you have seen. On the other hand, you are an expert C++ programmer now, at the time of the "challenge". I'll pick up your challenge and try to cook up something by tonight. After that, we'll have to pick up our challenge again in late august. Have a lot of fun! Alex ------------------- 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