From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,14f7200925acb579 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: No Go To's Forever! Date: 2000/03/24 Message-ID: <8berie$ja8$1@nnrp1.deja.com>#1/1 X-Deja-AN: 601609545 References: <8bbsc6$aes$1@nnrp1.deja.com> <8bdbof$t19$1@nnrp1.deja.com> <38DA9505.F1AE2989@acm.org> X-Http-Proxy: 1.0 x41.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Fri Mar 24 04:39:44 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-03-24T00:00:00+00:00 List-Id: In article <38DA9505.F1AE2989@acm.org>, jrcarter@acm.org wrote: > Robert Dewar wrote: > > Let's once again look at my original: > > > > > <> > > > for J in 1 .. N - 1 loop > > > if D (J) < D (J + 1) then > > > Swap (D (J), D (J + 1)); > > > goto Do_It_Again; > > > end if; > > > end loop; > > > Continue := True; > > Outer : while Continue loop > > Continue := False; > > Inner : for J in 1 .. N - 1 loop > > if D (J) < D (J + 1) then > > Swap (D (J), D (J + 1)); > > Continue := True; > > exit Inner; > > end if; > > end loop Inner; > > end loop Outer; > > Personally, I find both of these a bit difficult to follow due to the > lack of documentation. Maybe I'm wrong, but I think a variation on the > goto-less version is easier to document because the 2 loop are explicit: I must say it never occured to me that anyone would have trouble following how this algorithm works. I deliberately chose something so simple that this should not be an issue! But if you do want to document, I suggest doing it with formal proof conditions, you will find my point clearer if you do that. Sent via Deja.com http://www.deja.com/ Before you buy.