One of the joys of "short names" is that they have a habit of being both
cultural and experiential. In terms of i, j, k loop variables I have to
blame FORTRAN (in my engineering days) for that one (all vars starting with
letters I to n being integers).

On the other hand, when writing Pascal and Modula 2 I resorted to "count",
"count-1" etc. as it defined the intent of the variable. Sadly, it did not
take me long to go back to FORTRAN habits to use I, j and k (etc.) when the
intent of the variable was obvious.

My question is whether i, j and k are still recognised *globally* as viable
and therefore known loop counters? If so, are there other examples?

Carl

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
John Sturdy
Sent: 4 March 2005 11:39
To: Richard Bartlett
Cc: [email protected]
Subject: Re: PPIG discuss: About natural naming

OTOH, I think that some short names have come to influence what we
think of as natural, in particular
  i
  j
  k
as loop indices! I think that by now they have become more natural
than
  outer_loop_index
  middle_loop_index
  inner_loop_index
although I suppose calling something a "loop index" is not fully
informative... but taking as an example Warshall's algorithm (all pairs
connectivity / shortest paths)

  for i = 1 to n
    for j = 1 to n
      for k = 1 to n
        do
          if (a[i,j] & a[j,k])
             then
                a[i,k] = true;

what would it make sense to call them? In this example case, they
could be from_point_number, via_point_number, to_point_number ... but
is that how we think of them, or do we think of them as "counting loop
indices" ... in which case, perhaps we don't really think of them as
variables in the normal sense, but part of a stereotypical syntactical
construct?

__John
 
----------------------------------------------------------------------
PPIG Discuss List ([email protected])
Discuss admin: http://limitlessmail.net/mailman/listinfo/discuss
Announce admin: http://limitlessmail.net/mailman/listinfo/announce
PPIG Discuss archive: http://www.mail-archive.com/discuss%40ppig.org/

 
----------------------------------------------------------------------
PPIG Discuss List ([email protected])
Discuss admin: http://limitlessmail.net/mailman/listinfo/discuss
Announce admin: http://limitlessmail.net/mailman/listinfo/announce
PPIG Discuss archive: http://www.mail-archive.com/discuss%40ppig.org/

Reply via email to