Re: LIST "bug": .Remove on an empty list [message #73993 is a reply to message #73992] |
Tue, 14 December 2010 07:46   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst writes:
> Thinking about it a little more, I think I'm biased against IDL and thus making bad design decisions (sorry!). If there
> was a list "Empty" or "IsEmpty" method (like ruby's "empty?" method...for both arrays/lists and hashes), I would be more
> tempted to use it,
>
> if ( l.isempty() ) then ...return, handle error, whatever...
>
> as opposed to the current IDL idiom,
>
> if ( n_elements(l) eq 0 ) then ...return, handle error, whatever...
I can't stop to look into this today (18 pages yesterday!!),
but why can't you just write this ISEmpty method for yourself?
Function List::IsEmpty
IF N_Elements(self) EQ 0 THEN RETURN, 0 ELSE RETURN, 1
END
That would work, que no?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|