Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: starting fo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 3801 of 4325
Post > Topic >>

Re: starting forth ch4 problem 5

by Bruce McFarling <agila61@[EMAIL PROTECTED] > Mar 6, 2008 at 08:33 AM

On Mar 5, 6:25 pm, Ian Osgood <i...@[EMAIL PROTECTED]
> wrote:
> Unlike C's for loop, DO assumes the start is strictly less than the
> limit.

Unlike C's for loop, ``DO'' is written for a actual computer modulo
arithmetic, where +1 will always eventually bring any arbitrary
integer into agreement with any other arbitrary integer.

If you want ( 0 0 ) to step through every integer, you use ``DO LOOP''
and if you want ( 0 0 ) to not step through any, you use ``?DO LOOP''.

IOW, normal Forth ... tell the machine what you want it to DO, and it
will DO it, without trying to second-guess you.

What was broken in this example was the original code, where not
stepping through any integers for ( 0 0 ) would be desired, yet the
code said ``DO''.

Of course, as a learning exercise, the experience would have been
clearer in a 16-bit Forth, since 2^16 stars are more likely to
complete with the placid "OK" at the end before the person aborts than
2^32 stars. On an 80-column text monitor, that would be 819 full lines
of stars before the partial line with the ``OK''.
 




 9 Posts in Topic:
starting forth ch4 problem 5
gavino <gavcomedy@[EMA  2008-03-05 14:46:33 
Re: starting forth ch4 problem 5
Ian Osgood <iano@[EMAI  2008-03-05 15:25:25 
Re: starting forth ch4 problem 5
Elizabeth D Rather <er  2008-03-05 14:00:42 
Re: starting forth ch4 problem 5
anton@[EMAIL PROTECTED]   2008-03-06 10:27:54 
Re: starting forth ch4 problem 5
Bruce McFarling <agila  2008-03-06 08:33:23 
Re: starting forth ch4 problem 5
John Doty <jpd@[EMAIL   2008-03-06 20:08:44 
Re: starting forth ch4 problem 5
gavino <gavcomedy@[EMA  2008-03-06 09:13:51 
Re: starting forth ch4 problem 5
Elizabeth D Rather <er  2008-03-06 08:05:59 
Re: starting forth ch4 problem 5
Mikael Nordman <oh2aun  2008-03-06 18:49:57 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 16:35:23 CST 2008.