Article View: comp.lang.misc
Article #4421Re: GOTO controversy
From: Björn Helgason
Date: Tue, 02 Apr 1996 18:53
Date: Tue, 02 Apr 1996 18:53
63 lines
1777 bytes
1777 bytes
Scott Hawley wrote:
>
> What to you think? Loops without using loops?
>
> a loop:
>
> for(i=0;i<10;i++)
> {
> stuff
> }
>
> Looping with out a loop
>
> no_loop(0,10);
>
> no_loop(int start, int end)
> {
> if(start != end) {
> stuff
> no_loop(start+1,end);
> }
> }
>
> I haven't tested this but you get the idea.
In J I frequently use something like
empty keyra each vector
where vector contains number of elements which may or may not be
referenced in the verb keyra or subsequently called verbs. Its size
is used as a counter.
vector could look like this:
vector=.i.111
Keyra could look like this:
keyra=: 3 : 0
try. runni ''
catch. empty''
end.
)
each makes the verb keyra be called as many times as there are elements
in vector.
empty makes sure I do not get any display of any results.
each and empty are utilty verbs in J
runni is a verb called by keyra and is actually the one I want to
call but if it breaks down somewhere I dont want the operation to
halt but to continue with the next element of vector.
I do not specify any start nor end
--
/Gosi , bjornhp@simi.is
http://www2.simi.is/~gosi
http://www.jsoftware.com
Technical Details
Message-ID:
<316177A5.4005@simi.is>Path:
arc1-ca.pugleaf.net!news.simi.is!newsadmReferences:
<314FB5F5.259B@simi.is> <3151B47F.70FD@connix.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.simi.is!newsadm From: Björn Helgason <bjornhp@simi.is> Newsgroups: comp.lang.misc,comp.lang.c,comp.lang.pl1,comp.lang.apl Subject: Re: GOTO controversy Date: Tue, 02 Apr 1996 18:53:25 +0000 Organization: Post and Telecom Iceland, IS-150 Reykjavik, ICELAND Message-ID: <316177A5.4005@simi.is> References: <314FB5F5.259B@simi.is> <3151B47F.70FD@connix.com> NNTP-Posting-Host: simi.is Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 2.0 (Win95; I)