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/22 Message-ID: <8baqlu$3qp$1@nnrp1.deja.com>#1/1 X-Deja-AN: 600885390 References: <0mVB4.193$2K6.17499@news.pacbell.net> X-Http-Proxy: 1.0 x36.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Wed Mar 22 16:00:10 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-22T00:00:00+00:00 List-Id: In article <0mVB4.193$2K6.17499@news.pacbell.net>, tmoran@bix.com wrote: > How about: > > loop > look_ahead(in_file,ch,got_eol); > if got_eol then > skipline(infile); > elsif ch = ' ' > get(infile, ch); > else > exit; > end loop; OK, but that is really changing the algorithm, which is not always a satisfactory response. FOr example, if I offer the following sorting algorithm: <> 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; then you could show me a (much more efficient) bubble sort (which zips along at O(N**2) instead of the shorter algorithm above which is O(N**3)) but that would not really speak to the use of a goto in the above algorithm (I actually prefer the above statement with a goto, which really in this case is just a neat way of writing tail recursion) to the use of boolean flags etc. Of course you could argue that it is easier to find your refined superior form from my syntactic expression with nested loops than from the original with a goto, and that would be an interesting argument to make. > Sent via Deja.com http://www.deja.com/ Before you buy.