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

Home » Public Forums » archive » Re: Why does '[1,2,3] EQ [2]' yield zero but '[1,2,3] EQ 2' yield [0,1,0] ?
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: Why does '[1,2,3] EQ [2]' yield zero but '[1,2,3] EQ 2' yield [0,1,0] ? [message #54361 is a reply to message #54359] Sat, 02 June 2007 05:44 Go to previous messageGo to previous message
wlandsman@jhu.edu is currently offline  wlandsman@jhu.edu
Messages: 12
Registered: September 2006
Junior Member
> my guess:
>
> [1,2,3] EQ [2] compares two sets, one with 3 elements and the other 1.
>
I think the better rule to remember is that when comparing two vectors, IDL
will truncate the longer vector prior to the comparison so that the two
vectors have the same length. So [1,2,3] EQ [2] is the same as [1] EQ [2].
For another example,

IDL> print, [1,2,3] eq [1,2]
1 1

>
> [1,2,3] EQ 2 compares each element of the first set with number 2.
>
That is correct. --Wayne
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Why does '[1,2,3] EQ [2]' yield zero but '[1,2,3] EQ 2' yield [0,1,0] ?
Next Topic: Re: make_scalar?

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

Current Time: Sat Oct 11 10:10:51 PDT 2025

Total time taken to generate the page: 1.04003 seconds