Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #19694

Re: Loop structures

From "Ed" <invalid@nospam.com>
Newsgroups comp.lang.forth
Subject Re: Loop structures
Date 2013-02-13 14:48 +1100
Organization Aioe.org NNTP Server
Message-ID <kff2fn$76c$1@speranza.aioe.org> (permalink)
References (3 earlier) <1ky180m.kyfdfo1vhygioN%awegel@arcor.de> <kf9j5d$4ir$1@speranza.aioe.org> <aebd4e2b-c640-4907-bc6a-11f2694d5b83@i15g2000vbv.googlegroups.com> <kfeqjp$lo5$1@speranza.aioe.org> <rrednenPi_eKbIfMnZ2dnUVZ_gadnZ2d@supernews.com>

Show all headers | View raw


Elizabeth D. Rather wrote:
> On 2/12/13 3:34 PM, Ed wrote:
> > Mark Wills wrote:
> >> On Feb 11, 1:56 am, "Ed" <inva...@nospam.com> wrote:
> >>> Alex Wegel wrote:
> >>>> ...
> >>>> But you *do* agree that infinite loops exist (even in forth), and that
> >>>> they differ from the other constructs having been mentioned?
> >>> ...
> >>>> My original point wasn't so much about AGAIN, more about recognizing the
> >>>> infinite loop as a basic looping construct in general.
> >>>
> >>> None of the CS texts I've read mention infinite loops as a fundamental
> >>> construct. When they're discussed they're described in terms of the
> >>> classic loops, which in Forth would be BEGIN... 0 UNTIL or BEGIN...
> >>> 1 WHILE...REPEAT.
> >>>
> >>> "Starting FORTH" (first ed.) talks about creating infinite loops with
> >>> BEGIN...0 UNTIL. AFAIK AGAIN is not referenced anywhere.
> >>>
> >>> When this topic came up before some folks pointed out other
> >>> languages would optimize the equivalent of 0 UNTIL into an AGAIN.
> >>> Having a specific construct for infinite loops in these languages
> >>> would thus be redundant.
> >>>
> >>> Some folks say BEGIN... AGAIN is faster that BEGIN...0 UNTIL
> >>> but I can't think of a scenario where this would be true.
> >>
> >> It would be faster in my system ;-)
> >>
> >> My system doesn't compile a conditional branch. It compiles an
> >> unconditional branch.
> >>
> >> The definition of AGAIN in my system is:
> >>
> >> : AGAIN ( addr -- )
> >>      COMPILE BRANCH , ; IMMEDIATE
> >>
> >> Addresses in my system are absolute, not relative.
> >
> > So does mine.  But that wasn't the challenge.  Demonstrate - if you can -
> > that using BEGIN.. AGAIN in an application produces a speed improvement
> > over the equivalent BEGIN..0 UNTIL.
> >
> > My contention is that it won't and can't because the fastest scenario is
> > an empty infinite loop - which also happens to be the ultimate time waster.
> > The more useful things you do in the loop, the less time you waste, and
> > the less impact AGAIN or 0 UNTIL will have.
> >
> > The notion that BEGIN..AGAIN is faster than BEGIN..0 UNTIL is, as far
> > as I can determine, a wonderful delusion.
>
> Well, but you didn't stipulate a *significant* speed improvement. Mark
> indisputably demonstrated *a* speed improvement by removing an
> unnecessary test.

If the only way Mark can see that speed improvement is by spinning
in an empty loop doing nothing, where is his gain?

> Surely we can agree that AGAIN provides a very minor speed improvement
> on some systems, and a notational improvement, and leave it to folks to
> make individual value judgements about those things. This is far from
> the only such issue in Forth. There's 1+, 2* and 2/, a whole list of
> these little things. Some folks' aesthetics are offended by adding an
> unnecessary word to the system, others by executing an unnecessary
> instruction.

We're not discussing taste or offence, but need.  AGAIN does not occur
frequently and can't be justified in the same manner as the others you
mention.


Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

 Loop structures kenney@cix.compulink.co.uk - 2013-02-06 03:55 -0600
  Re: Loop structures Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-02-06 04:24 -0600
  Re: Loop structures Pablo Hugo Reda <pabloreda@gmail.com> - 2013-02-06 05:38 -0800
  Re: Loop structures Hugh Aguilar <hughaguilar96@yahoo.com> - 2013-02-06 10:43 -0800
    Re: Loop structures "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2013-02-08 03:46 -0500
  Re: Loop structures awegel@arcor.de (Alex Wegel) - 2013-02-06 20:19 +0100
    Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-07 20:27 +1100
      Re: Loop structures Coos Haak <chforth@hccnet.nl> - 2013-02-07 17:03 +0100
        Re: Loop structures awegel@arcor.de (Alex Wegel) - 2013-02-08 00:43 +0100
          Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-09 20:52 +1100
            Re: Loop structures Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-02-09 18:05 -0600
              Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-10 11:48 +1100
            Re: Loop structures awegel@arcor.de (Alex Wegel) - 2013-02-11 01:41 +0100
              Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-11 12:56 +1100
                Re: Loop structures "Elizabeth D. Rather" <erather@forth.com> - 2013-02-10 17:54 -1000
                Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-12 15:11 +1100
                Re: Loop structures Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-02-13 09:49 -0600
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-11 23:32 -0800
                Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-13 12:34 +1100
                Re: Loop structures "Elizabeth D. Rather" <erather@forth.com> - 2013-02-12 15:49 -1000
                Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-13 14:48 +1100
                Re: Loop structures Alex McDonald <blog@rivadpm.com> - 2013-02-12 23:02 -0800
                Re: Loop structures Alex McDonald <blog@rivadpm.com> - 2013-02-12 23:29 -0800
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-13 13:35 +0000
                Re: Loop structures Bernd Paysan <bernd.paysan@gmx.de> - 2013-02-13 15:17 +0100
                Re: Loop structures Alex McDonald <blog@rivadpm.com> - 2013-02-13 09:01 -0800
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-13 20:22 +0000
                Re: Loop structures anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-14 16:29 +0000
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-14 18:41 +0000
                Re: Loop structures Bernd Paysan <bernd.paysan@gmx.de> - 2013-02-14 21:44 +0100
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-14 21:06 +0000
                Re: Loop structures Bernd Paysan <bernd.paysan@gmx.de> - 2013-02-14 23:51 +0100
                Re: Loop structures mhx@iae.nl (Marcel Hendrix) - 2013-02-15 00:56 +0200
                Re: Loop structures anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-15 09:53 +0000
                Re: Loop structures m.a.m.hendrix@tue.nl - 2013-02-15 03:36 -0800
                Re: Loop structures anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-02-15 09:44 +0000
                Re: Loop structures Lars Brinkhoff <lars.spam@nocrew.org> - 2013-03-04 13:04 +0100
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-03-04 13:22 +0000
                Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-15 13:09 +1100
                Re: Loop structures Alex McDonald <blog@rivadpm.com> - 2013-02-14 19:21 -0800
                Re: Loop structures albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-02-15 13:01 +0000
                Re: Loop structures Alex McDonald <blog@rivadpm.com> - 2013-02-15 07:51 -0800
                Re: Loop structures Brad Eckert <hwfwguy@gmail.com> - 2013-02-13 10:51 -0800
                Re: Loop structures "Ed" <invalid@nospam.com> - 2013-02-15 13:11 +1100
                Re: Loop structures "Elizabeth D. Rather" <erather@forth.com> - 2013-02-14 21:31 -1000
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-13 00:18 -0800
                Re: Loop structures alberto@hal-pc.org - 2013-02-13 14:27 +0000
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-13 07:08 -0800
                Re: Loop structures m.a.m.hendrix@tue.nl - 2013-02-13 08:23 -0800
                Re: Loop structures stephenXXX@mpeforth.com (Stephen Pelc) - 2013-02-13 17:32 +0000
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-13 23:17 -0800
                Re: Loop structures stephenXXX@mpeforth.com (Stephen Pelc) - 2013-02-14 10:53 +0000
                Re: Loop structures stephenXXX@mpeforth.com (Stephen Pelc) - 2013-02-14 13:42 +0000
                Re: Loop structures "Clyde W. Phillips Jr." <cwpjr02@gmail.com> - 2013-02-14 21:25 -0800
                Re: Loop structures "Clyde W. Phillips Jr." <cwpjr02@gmail.com> - 2013-02-14 21:18 -0800
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-13 23:15 -0800
                Re: Loop structures mhx@iae.nl (Marcel Hendrix) - 2013-02-14 22:08 +0200
                Re: Loop structures Mark Wills <forthfreak@gmail.com> - 2013-02-14 22:53 -0800
                Re: Loop structures awegel@arcor.de (Alex Wegel) - 2013-02-12 16:00 +0100
  Re: Loop structures kenney@cix.compulink.co.uk - 2013-02-13 03:49 -0600

csiph-web