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


Groups > comp.lang.forth > #9890

Re: In Forth, is it valid or safe to use the value of 'I' after LOOP?

Date 2012-03-06 09:07 -1000
From "Elizabeth D. Rather" <erather@forth.com>
Organization FORTH, Inc.
Newsgroups comp.lang.forth
Subject Re: In Forth, is it valid or safe to use the value of 'I' after LOOP?
References <jj3ats$bsb$1@speranza.aioe.org> <1KGdnU2taaxgpMjSnZ2dnUVZ_hGdnZ2d@supernews.com> <jj5lar$n8d$1@speranza.aioe.org>
Message-ID <MMGdnUxDfcbF_cvSnZ2dnUVZ_s6dnZ2d@supernews.com> (permalink)

Show all headers | View raw


On 3/6/12 8:33 AM, Rod Pemberton wrote:
>> "Elizabeth D. Rather"<erather@forth.com>  wrote in message
> news:1KGdnU2taaxgpMjSnZ2dnUVZ_hGdnZ2d@supernews.com...
>>> On 3/5/12 11:23 AM, Rod Pemberton wrote:
> [...]
>
>> I isn't a "variable" it's a word that pushes a *copy* of the current
>> value of the loop counter onto the stack when it is executed. Once on
>> the stack, it's like any other stack item, to use as you see fit.
>
> Yes, I noticed that ...  It seems that that also restricts the use of 'I' to
> do "skip counters" too.  That's were you increment the loop index by some
> "skip" value in the middle of the loop.  These are useful for generating all
> sorts of numerical sequences.  E.g., in C, say you want to count from 1 to
> 20, but skip 10 to 14.  So, upon the condition that the loop index = 10, you
> can add five to the index.  It seems one would need to setup a separate
> variable in Forth to perform the skip.

If you need to manipulate the loop index, it's easy to do it with +LOOP. 
That's what it's for.

>> The loop counter itself doesn't *exist* outside the loop, in any Forth
>> that I know of.
>
> Ok, I found one Forth where 'I' is marked compile-only, but only checked
> three.   Those three allow 'I' to execute without a DO LOOP but return
> garbage.  So, I'd say 'I' does *exist* in some Forths, even if use is
> invalid or even if some Forths, e.g., compileable, don't recognize 'I' being
> defined or used outside a loop.

Oh, I didn't mean the *word* didn't exist, just that there is no defined 
semantics for it outside a loop.

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

In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-05 16:23 -0500
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-05 12:11 -1000
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-05 13:44 -1000
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 11:26 +0000
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-06 05:42 -0800
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 14:51 +0000
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-06 10:17 -0600
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 16:49 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-06 11:56 -0600
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 18:07 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-07 04:14 -0600
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 15:56 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 11:23 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:26 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 12:28 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 13:36 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 09:18 -1000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-06 20:14 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 08:22 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-07 10:20 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 11:11 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-07 19:07 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-08 10:11 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 09:36 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:01 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Alex McDonald <blog@rivadpm.com> - 2012-03-06 13:13 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:04 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-12 13:40 -0700
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-07 10:15 -0800
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 10:33 -0800
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-07 17:16 -1000
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 11:18 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 08:01 -1000
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 18:59 -0700
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-16 20:36 +0100
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 13:33 -0500
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 09:07 -1000
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 18:20 -0500
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 14:07 -1000
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? John Passaniti <john.passaniti@gmail.com> - 2012-03-06 16:53 -0800
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 19:26 -1000
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-10 19:04 -0500
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-10 18:44 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:06 -0400
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:01 -0700
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-03-11 12:51 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 14:04 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-11 14:41 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 05:16 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-12 08:06 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-03-11 21:55 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:17 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 11:00 +0000
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-11 17:27 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-11 14:12 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-11 21:48 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 14:24 -1000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:09 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:34 -0400
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 13:18 -1000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:32 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-13 13:18 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-19 03:36 -0400
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:37 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-16 05:31 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-19 03:38 -0400
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-19 11:35 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-16 20:39 +0100
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-12 12:50 -0700
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:27 -0700
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 08:16 -0800
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:09 -0700
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-05 14:23 -0800
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-05 17:42 -0800
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-06 09:36 -0800
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-08 10:41 +0000
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-08 05:38 -0800
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-09 10:32 -0800
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-12 19:26 -0700
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 04:15 -0400
  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-12 01:11 +0100
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:41 -0400
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:46 -1000
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-12 21:17 -0700
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 05:01 -0400
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 03:06 -0700
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-13 12:32 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 14:01 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-14 11:47 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 22:13 +0100
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-14 03:39 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-14 06:54 -1000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-14 16:39 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-15 10:49 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Alex McDonald <blog@rivadpm.com> - 2012-03-14 08:53 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 17:01 +0100
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? George Hubert <georgeahubert@yahoo.co.uk> - 2012-03-14 11:21 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 19:25 +0100
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-14 16:37 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:28 -0400
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "David N. Williams" <williams@umich.edu> - 2012-03-13 16:19 -0400
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-14 20:13 -0400

csiph-web