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

Home » Public Forums » archive » reverse problem
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: reverse problem [message #46178 is a reply to message #46053] Fri, 04 November 2005 09:22 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
R.G. Stockwell writes:


> As Paolo points out, the routine is returning the keyword value,
> replicated to the size of the input array. Neat!
> So, it is treating reverse as a single element array, then accessing
> it with the input array as an index (which exceeds the "reverse" array
> size, and by IDL's default rule, it replicates the last number).
>
> example:
> IDL> x = 1
>
> IDL> print, x(findgen(10))
>
> 1 1 1 1 1 1 1 1 1 1
>
>
> But the really really strange thing is that, as I showed in my original
> post,
> that the problem was persistent. After running the routine, the keyword
> "reverse"
> escaped the local scope of the routine, and came to main level (and thus
> overwriting the
> reverse function at the main level). Of course, this is how keywords are
> supposed to work,
> but it was kind of a surprise.

Oh, this is neat! This is now my favorite example
in my Pass-by_Reference, Pass-by-Value lecture. :-)

Cheers,

David

P.S. By the way, putting Compile_Opt idl2 in your IDL startup
file goes a LONG way to sorting out a lot of these kinds of
problem.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[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: online help IDL 6.2
Next Topic: Printinf Latitudes & Longitudes in a MAP using IDL

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

Current Time: Fri Oct 10 17:52:59 PDT 2025

Total time taken to generate the page: 0.24134 seconds