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

Re: Top 10 IDL Requests



In article <on66q4a433.fsf@cow.physics.wisc.edu>,
  craigmnet@cow.physics.wisc.edu wrote:

> * A way to index strings like arrays.
>
>   I know we can use STRMID and STRPUT, but it seems that an array-like
>   notation would fit so much better with the philosophy of IDL.
>

If I understand you correctly, then this was syntax that IDL used in its
ancient (Version 1) history, e.g. if st was a string array, then
st(3:5,*) extracted the third through fifth characters of all elements
of the array.    Of course, this was when IDL was limited to
fixed-length string arrays.   With the current variable length string
arrays, things are more complicated but the notation is still feasible.
For example, the first dimension of a string array could be defined to
be the maximum string length in the array.

But I am not sure that such a change would be desirable.     First of
all would be the difficulty in making a syntax change backwards
compatible.  The change of the string syntax from  V1 to V2  probably
required more coding  changes than any other syntax change ever made to
IDL. Also, some syntax would become more complicated -- for example, the
current extraction of elements of a string array st1 = st[3:5] would
have to become st1 = st[*,3:5].    V5.3 introduced many string
processing enhancements (e.g. STRMID now accepts vector parameters), so
I think all the functionality of the array notation is now available in
then string processing functions.  Finally, one can always index strings
like arrays by first converting them  with BYTE().

--Wayne Landsman                       landsman@mpb.gsfc.nasa.gov

P.S. I heartily endorse a COMPLEMENT keyword to the WHERE function.


Sent via Deja.com http://www.deja.com/
Before you buy.