It's a real and valuable service to signal an index error when the index is not in the expected range.
Ken Iverson originally (pre-1987) wanted the index to be unrestricted, but we talked him out of it. ----- Original Message ----- From: Bo Jacoby <[email protected]> Date: Saturday, March 7, 2009 10:07 Subject: [Jprogramming] The meaning of dyad 'from', ({) To: [email protected] > > To the very honored designers of J. > > The vocabulary states that: "If x is an integer in the range > from -n=: #y to n-1 , then x{y selects item n|x from y ." > > Now my question is the following: What is the purpose of the > restriction "in the range from -n=: #y to n-1"? Why not > simply define: "If x is an integer, then x{y selects item (#y)|x > from y ." ? > > This suggests a generalization of the present definition. Arrays > are then addressed cyclically, and the distinction between zero- > origin indexing and one-origin indexing disappears. > > For example: > > (i. 7) { i. 5 NB. Nobody prefers > an error message to a result. > |index error > | (i.7) {i.5 > > (i. 7) { i. 5 NB. My suggestion > is the result (here faked). > 0 1 2 3 4 0 1 > > (_5+i. 7) { i. 5 NB. it works in an arbitrarily > restricted interval > 0 1 2 3 4 0 1 > > > > Thank you. > > Bo Jacoby ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
