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


Groups > comp.lang.forth > #24739

Re: counted loops

Date 2013-07-23 07:24 -1000
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Newsgroups comp.lang.forth
Subject Re: counted loops
References (2 earlier) <2013Jul22.174620@mips.complang.tuwien.ac.at> <51ed8579$0$26873$e4fe514c@dreader37.news.xs4all.nl> <ksk3kk$ji2$1@dont-email.me> <3e-dneCnz7WpPnDMnZ2dnUVZ_tSdnZ2d@supernews.com> <2013Jul23.144213@mips.complang.tuwien.ac.at>
Message-ID <joSdndjkE9eqIXPMnZ2dnUVZ_o-dnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 7/23/13 2:42 AM, Anton Ertl wrote:
> "Elizabeth D. Rather" <erather@forth.com> writes:
>> I think DO ... LOOP is harder for implementers than users (especially
>> +LOOP). I've never seen a beginner have trouble with either one. The
>> both are pretty intuitive. If someone is unclear about, for example, how
>> +LOOP is going to act with negative increments, it's easy enough to type
>> in a test definition and try it. Much quicker than consulting a book!
>
> I don't think that the behaviour of
>
> ?DO ... -5 +LOOP
>
> for various parameter pairs is intuitive at all, especially if you
> know how
>
> ?DO ... 5 +LOOP
>
> behaves.  Sure, writing a test may be quicker than consulting a book
> (but that is more a comment on the quality of the books), but the user
> first has to be aware that -5 +LOOP is behaving unintuitively.

In most cases, +LOOP will do exactly what you expect. The situations in 
which you might be surprised are fairly specific and don't crop up that 
often. If you encounter one you can explore quickly.

If I'm sitting at my computer I can type in:

: test ( h l -- )   ?DO  I . -5 +LOOP ;

...in about 5 seconds. To reach for a book, open it, find the right page 
and read it will take a minute or more. Even if the book's a pdf, I have 
to find it on my computer, launch Acrobat, find the right section, etc.

Books are great for full explanations of why things work the way they 
do, but simply exploring is the best way to answer questions like this. 
Having found out what is going on, if you're curious as to why, you can 
research further. Or not.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

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


Thread

Happy pi approximation day Luca Saiu <positron@gnu.org> - 2013-07-21 22:45 +0200
  Re: Happy pi approximation day Coos Haak <chforth@hccnet.nl> - 2013-07-22 01:24 +0200
    Re: Happy pi approximation day Coos Haak <chforth@hccnet.nl> - 2013-07-22 01:27 +0200
  Re: Happy pi approximation day Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-22 01:14 -0700
    Re: Happy pi approximation day Luca Saiu <positron@gnu.org> - 2013-07-22 11:53 +0200
    Re: Happy pi approximation day anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-22 15:46 +0000
      Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 19:18 +0000
        Re: Happy pi approximation day Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-22 21:17 +0100
          Re: Happy pi approximation day "Elizabeth D. Rather" <erather@forth.com> - 2013-07-22 11:25 -1000
            counted loops (was: Happy pi approximation day) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 12:42 +0000
              Re: counted loops "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 07:24 -1000
                Re: counted loops anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 17:33 +0000
                Re: counted loops "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 08:06 -1000
                Re: counted loops albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 19:47 +0000
                Re: counted loops "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 10:02 -1000
                Re: counted loops Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-23 14:58 -0500
                Re: counted loops "Elizabeth D. Rather" <erather@forth.com> - 2013-07-23 10:14 -1000
                Re: counted loops anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-24 08:13 +0000
                Re: counted loops Elizabeth D Rather <erather@forth.com> - 2013-07-23 22:42 -1000
                Re: counted loops stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:55 +0000
                Re: counted loops stephenXXX@mpeforth.com (Stephen Pelc) - 2013-07-24 09:37 +0000
          Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 01:30 +0000
            Re: Happy pi approximation day "Elizabeth D. Rather" <erather@forth.com> - 2013-07-22 19:08 -1000
            Re: Happy pi approximation day m.a.m.hendrix@tue.nl - 2013-07-23 00:19 -0700
            Re: Happy pi approximation day anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 13:07 +0000
              Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-23 17:37 +0000
          Re: Happy pi approximation day anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-23 12:31 +0000
            Re: Happy pi approximation day Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2013-07-23 19:39 +0100
              Re: Happy pi approximation day anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-07-24 08:16 +0000
                Re: Happy pi approximation day Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-24 04:23 -0700
                Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-24 11:59 +0000
                Re: Happy pi approximation day Bernd Paysan <bernd.paysan@gmx.de> - 2013-07-24 21:32 +0200
                Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-24 20:07 +0000
                Re: Happy pi approximation day Bernd Paysan <bernd.paysan@gmx.de> - 2013-07-24 23:20 +0200
  Re: Happy pi approximation day m.a.m.hendrix@tue.nl - 2013-07-22 01:30 -0700
    Re: Happy pi approximation day Luca Saiu <positron@gnu.org> - 2013-07-22 11:55 +0200
    Re: Happy pi approximation day albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-22 11:24 +0000
      Re: Happy pi approximation day Richard Owlett <rowlett@pcnetinc.com> - 2013-07-22 10:48 -0500
        Re: Happy pi approximation day Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-22 14:44 -0500
  Re: Happy pi approximation day Mark Wills <markrobertwills@yahoo.co.uk> - 2013-07-24 00:43 -0700
    Re: Happy pi approximation day Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-07-24 03:07 -0500

csiph-web