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

Home » Public Forums » archive » Re: LIST "bug": .Remove on an empty list
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: LIST "bug": .Remove on an empty list [message #73993 is a reply to message #73992] Tue, 14 December 2010 07:46 Go to previous messageGo to previous message
David Fanning is currently offline  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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: LIST performance
Next Topic: LIST "bug": .Remove on an empty list

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

Current Time: Wed Oct 08 19:32:55 PDT 2025

Total time taken to generate the page: 0.00436 seconds