> How does APL interpret negative index for either index origin? No APL I know of implements negative indexing. It would be a consistent extension because it'd replace an error with a result.
----- Original Message ----- From: bill lam <[email protected]> Date: Tuesday, July 27, 2010 16:57 Subject: Re: [Jprogramming] index origin 0 To: [email protected] > Втр, 27 Июл 2010, Alex Rufon писал(а): > > +-+-+-------------------------------------+ > > |4|:|NB. indices-of-elements (IO=1) from y| > > | | |(_1 + x) { > y | > > +-+-+-------------------------------------+ > > This equation is interesting. So when counting from the end. > the last item is A[0], the second last item is A[-1] > ie. index origin 0 > > whereas for J the last item is A[-1], second last is A[-2] > ie, index origin 1 > > To be more correct for human domain so that always use index > origin 1 > when counting both from the beginning and from the end, it can be > improved as > > if. 0=x do. assert. 0 > elseif. 0<x do. (_1+x){y > elseif. do. x{y > end. > > How does APL interpret negative index for either index origin? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
