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

Home » Public Forums » archive » Empty arrays?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Empty arrays? [message #63439] Mon, 10 November 2008 14:07 Go to next message
Anonymous
Originally posted by: Demitri

Hello,

I'm starting to dig into IDL programming, and one thing I've found
particularly annoying is the lack of support for empty arrays. Although
I'm using IDL's OO capabilities, I find that I'm spending a lot of time
testing for return results where an empty array would be much more
suitable.

If I'm building an array that will have zero or more entries, I create
a variable, "insert" a dummy value, go through the code adding entries
based on whatever logic, then pop the top dummy value. But even then I
have to check that more than one entry is there so I dont throw an
error with a

return, a[1:*]

This is very basic functionality. Does anyone have a particularly
elegant... well, I'd say solution, but anything is obviously a
workaround. I don't want to fight the language, but I get the feeling
that IDL's philosophy is "yeah, you do it yourself. I can't be
bothered."

Cheers,

Demitri
Re: Empty arrays? [message #63547 is a reply to message #63439] Tue, 11 November 2008 14:41 Go to previous message
Anonymous
Originally posted by: Demitri

> I agree, IDL is sorely missing the concept of an "empty array." In
> fact it was one of my "Top IDL requests" in the year 2000 :-)

I can see they got right on that. :)

Thanks to Craig and Mike for the tips, and more importantly the code
saving me from having to do it myself!

Cheers,

Demitri
Re: Empty arrays? [message #63563 is a reply to message #63439] Tue, 11 November 2008 10:45 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Nov 10, 5:07 pm, Demitri wrote:
> Hello,
>
> I'm starting to dig into IDL programming, and one thing I've found
> particularly annoying is the lack of support for empty arrays. Although
> I'm using IDL's OO capabilities, I find that I'm spending a lot of time
> testing for return results where an empty array would be much more
> suitable.
...
> This is very basic functionality. Does anyone have a particularly
> elegant... well, I'd say solution, but anything is obviously a
> workaround. I don't want to fight the language, but I get the feeling
> that IDL's philosophy is "yeah, you do it yourself. I can't be
> bothered."

I agree, IDL is sorely missing the concept of an "empty array." In
fact it was one of my "Top IDL requests" in the year 2000 :-)

When I need to manage arrays like lists (and deal with all the cases),
I tend to use my CMINSERT and CMDELETE functions. They more or less
condense the stupid crap-work into an easy-to-read function call. Of
course you sacrifice some performance, but I *tried* to make it
perform as well as I could.

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Quaternion spherical interpolation in PV-Wave
Next Topic: map_image edge distortion

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

Current Time: Wed Oct 08 18:58:49 PDT 2025

Total time taken to generate the page: 0.00483 seconds