Re: Loop Arrays [message #26978 is a reply to message #26977] |
Tue, 09 October 2001 12:57   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ken Mankoff (mankoff@lasp.colorado.edu) writes:
> I am interested in creating circular arrays, where subscripts that would
> be out-of-bounds on a regular array just start indexing on the other side
> of the array.
>
> ex:
> a = circleIndgen( 10 )
> print, a[ -1 ]
> 9
> print, a[ 11 ]
> 1
> print, a[ [0,10,20,100] ]
> 0, 0, 0, 0
>
> print, a[ 8:11 ]
> 8, 9, 0, 1
>
> ;;; not sure if this makes sense, but i think it can easily be
> ;;; done if the rest is possible...
> print, a[ 8:2 ]
> 8, 9, 0, 1
>
> I think that overloading the [] operators is not an option from my
> understanding of IDL. Does anyone know if this is possible?
Uh, you must have dropped your notes from your C++ course
and got them mixed up with your print-outs of IDL
newsgroup articles. :-)
There isn't going to be any "overloading of operators"
in IDL, I can assure you of that.
Although you *could* create an object that could produce
the results you want when you call, for example, the
SubSet method (or whatever).
> Desirable? Dumb?
Depends entirely on what you are trying to do.
Although it does seem like an awful lot of work
to me. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|