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

Home » Public Forums » archive » Re: Curious array behaviour?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Curious array behaviour? [message #5] Fri, 15 March 1991 15:02
steve is currently offline  steve
Messages: 19
Registered: March 1991
Junior Member
In article <275@locke.water.ca.gov>, rfinch@caldwr.water.ca.gov (Ralph Finch) writes:
>
> PV-Wave 3.02 on a Sun 4.
>
> Array operations are quite powerful in idl-wave and so different from
> other languages that I think I still don't fully understand them.
> Here is something that has me puzzled:
>
> a=[1,2,3,4,5]
> print,a([-1])
> -> 1
> print,a(-1)
> -> ERROR
>
> Why the difference?

Looks like a 'feature' to me. One explanation for it might be that one
commonly will use this syntax for 'mapping' an array through a lookup
table, and in this case it makes sense to have range checking for
values off the end of the LUT and 'clamp' them to the end values... i.e.:

lut=[0.1,0.5,0.75,0.9,0.95]
values=[0,1,2,3,4,5,-1,11,4,3,2,7]
print,lut(values)
-> .100000 .500000 .750000 .900000 .950000 .950000
-> .100000 .950000 .950000 .900000 .750000 .950000

Isn't it fun to think up justifications for inconsistent program behavior...
and you get lots of practice working with WAVE/IDL :-).

-steve
--
-------------------------------------------------------+"Come, Watson, come!"
Steve Swales (716) 275-0265,-3857,-5101| he cried. "The game is
steve@lle.rochester.edu (128.151.32.111)| afoot. Not a word!
| Into your clothes and
University of Rochester 250 East River Road| come!" S.H.
Laboratory for Laser Energetics Rochester, NY 14623| 'The Abbey Grange'
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Curious array behaviour?
Next Topic: Cubic interpolations

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

Current Time: Sun Oct 12 02:00:37 PDT 2025

Total time taken to generate the page: 1.12094 seconds