[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

User selectable lower array bound?



Hey there,

Is is just me, or would anyone else find useful the ability to define arrays in IDL such
that the lower bound is *not* always zero? Sorta like:

  x = FINDGEN( 11, LOWER = -5 )
or
  y = DBLARR( 100, LOWER = 1 )

so that accessing elements such as x[ -4 ] or y[ 100 ] are o.k.?

I know this can be done now with judicious use of proxy indices, e.g.

  FOR i = -5, 5 DO BEGIN
    ix = i + 5
    PRINT, x[ ix ]
    ....do other stuff with negative i's....
  ENDFOR

but sometimes this makes code hard to follow (or explain to someone who's never used the
code before) in direct correspondence with a physical process.

It seems like such a simple thing to be able to do (with default action being start at
index 0) although I'm sure the amount of work required to implement this would be
horrendous. Still, it shur would be nice.....

paulv

-- 
Paul van Delst           A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP        Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274  There shallow draughts intoxicate the brain,
Fax:(301)763-8545        And drinking largely sobers us again.
                                         Alexander Pope.