comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Still missing features in IDL 8
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Still missing features in IDL 8 [message #73212 is a reply to message #72898] Mon, 01 November 2010 08:30 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Oct 31, 6:00 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Oct 13, 2:38 pm, Chris Torrence <gorth...@gmail.com> wrote:
>
>
>
>> Regarding #2, what if you could use additional indices to access array
>> elements within lists?
>
>> For example:
>
>> IDL> a = LIST(FINDGEN(10), BYTARR(5,3))
>> IDL> help, a[0]
>> <Expression>    FLOAT     = Array[10]
>> IDL> help, a[0,3]   ; currently throws an error in IDL8.0
>> <Expression>    FLOAT     =       3.00000
>> IDL> a[0,3] = !pi   ; currently throws an error in IDL8.0
>
>> IDL> help, a[1]
>> <Expression>    BYTE      = Array[5, 3]
>> IDL> help, a[1,4,2]   ; currently throws an error in IDL8.0
>> <Expression>    BYTE      =    0
>> IDL> a[1,4,2] = 255   ; currently throws an error in IDL8.0
>
>> So the first index would give the list element, and the remaining
>> indices would index into the array itself. Obviously you could only
>> have up to 7 dimensions in your contained array, but that probably
>> isn't a huge limitation.
>
> I was writing a class like that, inheriting from list, and that
> brought me a question: Should the extra dimension (of the list index)
> be on the left, as above, or on the right?
>
> The notation (already valid for retrieving values) (a[1])[0] suggests
> that the array index should come on the left. However, writing a[1,0]
> suggests array dimensions, in which case the list index would make
> more sense on the right, as the list dimension is the slowest-varying
> one.
>
> Tough it would be a bit incoherent with the array dimension order, it
> seems to me that it is better to have the list index on the left. That
> way,
>
> print,(a[1])[0] ;already valid
>
> would be the same as
>
> print,a[1,0]
>
> instead of the more confusing
>
> print,a[0,1]
>
> Any thoughts on that?

Yes, that is exactly what I was thinking.

Back to your original thread - if we added this way of subscripting,
does that eliminate the need to convert a list to/from a pointer
array? I'd rather not add more functionality if we don't have to.

-Chris
ITTVIS
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: modify the attribute value within a tag container
Next Topic: Re: how to calculate latitude and longitude from range and direction(azimuth and elevation)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:54:23 PDT 2025

Total time taken to generate the page: 0.64197 seconds