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

Home » Public Forums » archive » Re: bug? or how to distinguish between a Hash and an array of Hashes ?
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: bug? or how to distinguish between a Hash and an array of Hashes ? [message #83393 is a reply to message #83392] Mon, 04 March 2013 08:11 Go to previous messageGo to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
You could use the TYPENAME function to distinguish the two variables

IDL> print,typename(a)
HASH
IDL> print,typename(c)
OBJREF

although I'm not sure why SIZE(/TNAME) doesn't give the same results. --Wayne

On Monday, March 4, 2013 11:05:03 AM UTC-5, superchromix wrote:
> surprisingly, the ISA function doesn't help here either...
>
>
>
>
>
> pro test
>
>
>
> a = hash('first', 1, 'second', 2)
>
> b = hash('third', 3, 'fourth', 4, 'fifth', 5)
>
>
>
> print, 'Output of SIZE() for a HASH varible:'
>
> print, size(a, /STRUCTURE)
>
>
>
> c = [a,b]
>
> print, 'Output of SIZE() for an array of HASHes:'
>
> print, size(c, /STRUCTURE)
>
>
>
> print, 'Output of ISA(/ARRAY) for scalar hash:'
>
> print, isa(a, /array)
>
>
>
> print, 'Output of ISA(/ARRAY) for array of hashes:'
>
> print, isa(c, /array)
>
>
>
> help, a, output=ahelp
>
> help, c, output=chelp
>
>
>
> print, 'Help for scalar hash:'
>
> print, ahelp
>
>
>
> print, 'Help for array of hashes:'
>
> print, chelp
>
>
>
> end
>
>
>
> Output of SIZE() for a HASH varible:
>
> { OBJREF 11 0 0 2
>
> 1 2 0 0 0
>
> 0 0 0 0
>
> }
>
> Output of SIZE() for an array of HASHes:
>
> { OBJREF 11 0 0 2
>
> 1 2 0 0 0
>
> 0 0 0 0
>
> }
>
> Output of ISA(/ARRAY) for scalar hash:
>
> 1
>
> Output of ISA(/ARRAY) for array of hashes:
>
> 1
>
> Help for scalar hash:
>
> A HASH <ID=154 NELEMENTS=2>
>
> Help for array of hashes:
>
> C OBJREF = Array[2]
[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
Previous Topic: bug? or how to distinguish between a Hash and an array of Hashes ?
Next Topic: Nan represented by a gray area

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

Current Time: Wed Oct 08 18:19:12 PDT 2025

Total time taken to generate the page: 0.00174 seconds