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 PAA26425; Thu, 11 Oct 2001 15:12:09 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA26442 for ; Thu, 11 Oct 2001 15:12:08 +0200 (MET DST) Received: from www.image-acquire.com (valkyrie.image-acquire.com [207.71.8.230]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f9BDC7b11891 for ; Thu, 11 Oct 2001 15:12:07 +0200 (MET DST) Received: from [192.168.0.2] (203-79-84-44.adsl.paradise.net.nz [203.79.84.44]) by www.image-acquire.com (8.9.3/8.9.3) with ESMTP id IAA14041; Thu, 11 Oct 2001 08:11:10 -0500 Mime-Version: 1.0 X-Sender: bruce@www.hoult.org Message-Id: In-Reply-To: <20011011144733.A3985@gogol.zorgol> References: <004001c15218$29c42e20$0b01a8c0@mit.edu> <20011011144733.A3985@gogol.zorgol> Date: Fri, 12 Oct 2001 02:11:01 +1300 To: Berke Durak , Jeff Henrikson From: Bruce Hoult Subject: Re: [Caml-list] C style for loop Cc: caml-list@inria.fr Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk At 2:47 PM +0200 11/10/01, Berke Durak wrote: >On Thu, Oct 11, 2001 at 01:47:07AM -0400, Jeff Henrikson wrote: > >> Okay, so maybe I should be more specific about what I want in a >> "C-style for loop." Its readablity merits are hopefully self >> evident. Well, unless you're a compulsive CPS addict who wishes >> even his grocery list could be written to tail recurse. . . > >[...] > >Do you really pretend that ``C-style for loops'' have ``self-evident >readability merits'' ?! My opinion is that ```C-style'' loop syntax >IS unreadable, ununderstandable and unprovable. How many people using >C know the _exact_ semantics of : > > for(exp1;expr2;expr3){expr4} Sure, it's easy: { exp1; while (expr2){ expr4; expr3; } } It's damn ugly, though, and with much unnecessary repetition of the control variable in simple cases. >I never manage to remember if expr3 is evaluated if expr2 is always >zero. No. See above. > However with > > for i = 0 to 33 do > f i > done > >the ONLY little point about which you MIGHT hesitate is : does f 33 >get called or does the loop stop at 32 ? Dylan makes has explicit versions: for (i from 0 to 33) end for (i from 0 below 33) end -- Bruce ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr