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

Home » Public Forums » archive » N_ELEMENTS and WHERE: Scalar or Array ?
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: N_ELEMENTS and WHERE: Scalar or Array ? [message #14181 is a reply to message #14130] Wed, 03 February 1999 00:00 Go to previous messageGo to previous message
wmc is currently offline  wmc
Messages: 117
Registered: February 1995
Senior Member
Craig Markwardt <craigmnet@astrog.physics.wisc.edu> wrote:
> wmc@bas.ac.uk writes:
>> ...
>> But since this has come up, & its one of my pet peeves: why cannot where
>> return a null array to indicate no-elements-match. And then array[null] would
>> match to nothing. This would allow one to say
>>
>> array[where(wurble)]='stoat'

> Amen brother! It is sadly unfortunate that where(0) returns a number
> at all. A null array -- if IDL had them! -- would be the best.

> Of course, there is the trade-off between power user and newbie user.
> Consider the following:

> wh_one = where(x GT 1)
> x[wh_ine] = 0 ; NOTE the type

> Because of the typo, the second statement would have the mysterious
> side effect of having no effect at all! (including no error message) I
> would still love to have it, but newbies might go crazy.

No, we're not going completely perl here: there is a distinction between an
undeclared variable (which would still cause an error in your example above)
and a variable initialised with a null value (which is what I would like
"where" to return). So your newbie would be safe.

In fact, would there be a problem with a "null" type, which would perhaps be
variable type #11? Then you don't have to worry about the actual value it
contains.

-W.

--
William M Connolley | wmc@bas.ac.uk | http://www.nbs.ac.uk/public/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
[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
Previous Topic: Scalp editting??
Next Topic: Map spanning Dateline?

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

Current Time: Wed Oct 08 19:10:04 PDT 2025

Total time taken to generate the page: 0.00499 seconds