Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42020
| Newsgroups | comp.lang.forth |
|---|---|
| Date | 2015-09-15 16:13 -0700 |
| References | (2 earlier) <mt5b3m$2c9$1@speranza.aioe.org> <2015Sep14.103356@mips.complang.tuwien.ac.at> <mt8f9i$qm3$1@speranza.aioe.org> <y7pior0acvxj.ch2dlom72stl$.dlg@40tude.net> <2015Sep15.171318@mips.complang.tuwien.ac.at> |
| Message-ID | <b020e43e-e285-4323-a0e3-e8bb2a9c2bed@googlegroups.com> (permalink) |
| Subject | Re: old `leave` renamed to `exhaust` |
| From | hughaguilar96@gmail.com |
On Tuesday, September 15, 2015 at 8:52:48 AM UTC-7, Anton Ertl wrote: > Coos Haak <chforth@hccnet.nl> writes: > >Is there any description of what /LOOP and \LOOP are supposed to do? > >I've never found an implementation of them, even several versions > >of Gforth don't have them. > > We introduced -LOOP a long time ago, and I learned about \LOOP only a > few months ago (and nobody answered my question about the exact > behavior); with the existence of \LOOP the name /LOOP also makes more > sense. > > Anyway, my impression until now is that /LOOP is for counting upwards > with a step size >1, and \LOOP is for counting downwards. > > Here is how Gforth's -LOOP behaves: > > `-2 0 ?DO i . 1 -LOOP' prints `0 -1' > `-1 0 ?DO i . 1 -LOOP' prints `0' > ` 0 0 ?DO i . 1 -LOOP' prints nothing > > The current looping constructs for negative stride in Gforth still > have one weakness, though: > > When walking backwards over an array addr u of cells, we would like to > start with addr u 1- cells + and end with addr, but that's relatively > cumbersome to express, e.g.: > > addr 1 cells - addr u 1- cells + ?do ... i ... 1 cells -loop > > or (less run-time efficiency) > > addr addr u cells + ?do ... i 1 cells - ... 1 cells -loop > > - anton Forth-200x is hamstrung by the mandate that it be 100% compatible with ANS-Forth. You just add more complexity and more words to the vocabulary, but you aren't addressing the serious problems of DO loops: 1.) DO loops use the return-stack, but >R also uses the return-stack, so they clash. Any >R data from outside of the loop is not available inside of the loop, and any >R data inside of the loop has to be removed with R> before the loop iterates again. 2.) DO loops use the pseudo-variables I and J. In nested loops, I is the index of the outer loop in the outer loop, but the name changes to J inside of the inner loop, at which time the I is the index of the inner loop. 3.) DO loops are asymmetric going up or down, which is very non-intuitive. These three aspects of DO loops are extremely difficult to explain to novices. The more you try to explain, the more foolish you appear to be. This is true even if the novice has never programmed at all before, but if the novice has any experience in any other language (even line-number BASIC), the novice is going to consider this to be utter foolishness. DO loops were badly designed. Over time, more and more words were added to DO loops to provide more and more capability. We now have: DO ?DO LOOP +LOOP /LOOP \LOOP LEAVE UNLOOP This is a lot of words, just to accomplish iteration. In my language I have |ITERATE that does iteration. I also have |EACH and some others that are specifically for iterating through linked lists. Iteration is not all that complicated --- you start with a bad design though, and you pile complexity on top of complexity, and you end up with a big mess.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
old `leave` renamed to `exhaust` Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2015-09-07 20:29 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-08 14:52 +1000
Re: old `leave` renamed to `exhaust` Mark Wills <markwills1970@gmail.com> - 2015-09-08 00:57 -0700
Re: old `leave` renamed to `exhaust` Bernd Paysan <bernd.paysan@gmx.de> - 2015-09-08 15:19 +0200
Re: old `leave` renamed to `exhaust` Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2015-09-08 16:25 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-09 11:39 +1000
Re: old `leave` renamed to `exhaust` Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2015-09-09 10:42 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-10 14:05 +1000
Re: old `leave` renamed to `exhaust` Marcos Cruz <null_email_so_use_my_contact_page@programandala.net> - 2015-09-10 13:33 +0000
Re: old `leave` renamed to `exhaust` Coos Haak <chforth@hccnet.nl> - 2015-09-10 22:04 +0200
Re: old `leave` renamed to `exhaust` Coos Haak <chforth@hccnet.nl> - 2015-09-10 22:13 +0200
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-11 13:14 +1000
Re: old `leave` renamed to `exhaust` Coos Haak <chforth@hccnet.nl> - 2015-09-11 12:30 +0200
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-11 21:47 +1000
Re: old `leave` renamed to `exhaust` Bernd Paysan <bernd.paysan@gmx.de> - 2015-09-11 14:09 +0200
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-12 11:29 +1000
Re: old `leave` renamed to `exhaust` "Elizabeth D. Rather" <erather@forth.com> - 2015-09-11 16:05 -1000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-14 12:25 +1000
Re: old `leave` renamed to `exhaust` "Elizabeth D. Rather" <erather@forth.com> - 2015-09-13 17:53 -1000
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-14 08:33 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-15 16:55 +1000
Re: old `leave` renamed to `exhaust` hughaguilar96@gmail.com - 2015-09-15 01:46 -0700
Re: old `leave` renamed to `exhaust` Coos Haak <chforth@hccnet.nl> - 2015-09-15 15:14 +0200
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-15 15:13 +0000
Re: old `leave` renamed to `exhaust` hughaguilar96@gmail.com - 2015-09-15 16:13 -0700
Re: old `leave` renamed to `exhaust` jim.brakefield@ieee.org - 2015-09-15 17:05 -0700
Re: old `leave` renamed to `exhaust` hughaguilar96@gmail.com - 2015-09-15 18:35 -0700
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-19 11:42 +1000
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-19 10:48 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-20 00:01 +1000
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-19 15:02 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-21 15:51 +1000
Re: old `leave` renamed to `exhaust` "Elizabeth D. Rather" <erather@forth.com> - 2015-09-15 08:45 -1000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-16 11:18 +1000
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-16 06:10 +0000
Re: old `leave` renamed to `exhaust` "HAA" <someone@microsoft.com> - 2015-09-17 15:15 +1000
Re: old `leave` renamed to `exhaust` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-09-17 06:04 +0000
Re: old `leave` renamed to `exhaust` Coos Haak <chforth@hccnet.nl> - 2015-09-11 14:16 +0200
csiph-web