Forth is Factorable --- factoring out DO ... LOOP

This is a discussion on Forth is Factorable --- factoring out DO ... LOOP within the Forth forums in Programming Languages category; On Aug 21, 2:37*am, astrobe <fduboi...@gmail.com> wrote: > > Your "factored" DO/LOOP doesn't offer an index variable, so it's not a > > replacement for DO/LOOP. *You could of course come up with a > > equivalent for words like I and J and helper functions to allow > > providing the index and limit... but the result would be much more > > clumsy. *There might be some value in this if you routinely find your > > loop bodies are typically single Forth words. *Otherwise, you're going > > to be forced to create names for your loop ...

Go Back   Application Development Forum > Programming Languages > Forth

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #11  
Old 08-22-2008, 02:24 AM
John Passaniti
Guest
 
Default Re: Forth is Factorable --- factoring out DO ... LOOP

On Aug 21, 2:37*am, astrobe <fduboi...@gmail.com> wrote:
> > Your "factored" DO/LOOP doesn't offer an index variable, so it's not a
> > replacement for DO/LOOP. *You could of course come up with a
> > equivalent for words like I and J and helper functions to allow
> > providing the index and limit... but the result would be much more
> > clumsy. *There might be some value in this if you routinely find your
> > loop bodies are typically single Forth words. *Otherwise, you're going
> > to be forced to create names for your loop bodies or quote them
> > with :NONAME. *Ick.

>
> Bad mood, John?


Not particularly, so let's review. Someone posts a message stating DO/
LOOP is factorable. The code posted doesn't replicate the behavior of
DO/LOOP (as it doesn't maintain an index variable) so I point that out
that a claim of factorability of DO/LOOP was not demonstrated (as
claimed in the subject line). I also point out that the obvious and
unremarkable consequences of his code-- that loop bodies had to be
defined as words, forcing naming loop bodies (an issue I also have
with LSE64) or using Forth's ugly :NONAME.

> One may see a prototype of iterators, or map/reduce/filter/fold
> implementation. If one moves those XTs to the return stack of course.


And the next time someone's personal journey of discovery leads to
using deferred variables to drive behavior based on context, we can
claim it's a prototype of polymorphism.
Reply With Quote
  #12  
Old 08-22-2008, 06:56 AM
astrobe
Guest
 
Default Re: Forth is Factorable --- factoring out DO ... LOOP

[...]
> > One may see a prototype of iterators, or map/reduce/filter/fold
> > implementation. If one moves those XTs to the return stack of course.

>
> And the next time someone's personal journey of discovery leads to
> using deferred variables to drive behavior based on context, we can
> claim it's a prototype of polymorphism.


Yes! Glad to see you're friendly and supportive again! :-)

Amicalement,
Astrobe
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:12 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.