On 6/20/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
RE: http://www.jsoftware.com/help/primer/basic_list_adding.htm

I think it would be nice to poke people's memory with a for_item. based example
instead of just using while.

Here's the naive version, done with for

addlis =: 4 : 0
r =. ''
for_i. x
do.
 r =. r , (i_index { x) + (i_index { y)
end.
r
)

But this conflicts with the final paragraph on that page.  Most
programmers do not use a "for loop" construct which grants
implicit access to both values and their indices. [ And, in languages
which do offer that kind of construct, it's usually present as something
like an iterator method rather than as a for loop.]

More specifically, most languages treat looping as an indeterminate
construct -- you start at the beginning, but then must test each time
through the loop to see if you are done yet.  And that, I think, is the
point of that part of that page.

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to