🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5255

For loops (was: Re: From Modula to Oberon)

#5255
From: John Myers
Date: Fri, 11 Mar 1988 18:41
27 lines
1519 bytes
In article <1301@eneevax.UUCP> noise@eneevax.umd.edu.UUCP (Johnson Noise) writes:
>In article <1345@daimi.UUCP> erja@daimi.UUCP (Erik Jacobsen) writes:
>
>>This problem does not exist with WHILE/REPEAT-loops, and removing
>>the FOR-loop from a language is one effective way of making it
>>cleaner.
>
>	I guess I don't have to tell you how C handles the problem.
>In my opinion, it is by far, the most logical.

The for construct I know about which is by far the most logical
(though is also the hardest to implement efficiently) is the one
provided by CLU.

In short, CLU has this construct called an "iterator", which is
similar to a procedure, but instead of returning a single set of
values, "yields" a sequence of sets of values.  Each set is are
assigned in turn to the loop variables of a for statement and the body
of the for statement is executed.

-----
BTW: In C, one of my favorite standard macros is:

#define _forlist(var,init,next) for((var)=(init);var;(var)=(var)->next)

-- 
John G. Myers				John.Myers@k.gp.cs.cmu.edu
Technical Details
Message-ID: <1103@PT.CS.CMU.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!K.GP.CS.CMU.EDU!jgm
References: <7161@sol.ARPA> <2787@enea.se> <1345@daimi.UUCP> <1301@eneevax.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!K.GP.CS.CMU.EDU!jgm
From: jgm@K.GP.CS.CMU.EDU (John Myers)
Newsgroups: comp.lang.misc
Subject: For loops (was: Re: From Modula to Oberon)
Message-ID: <1103@PT.CS.CMU.EDU>
Date: 11 Mar 88 18:41:22 GMT
References: <7161@sol.ARPA> <2787@enea.se> <1345@daimi.UUCP> <1301@eneevax.UUCP>
Sender: netnews@PT.CS.CMU.EDU
Organization: System/Technology Development Corp.
Lines: 27
Keywords: FOR