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

Home » Public Forums » archive » User selectable lower array bound?
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: User selectable lower array bound? [message #26142 is a reply to message #25981] Wed, 08 August 2001 12:26 Go to previous messageGo to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Marc Schellens wrote:
>
>> Think Perl. For example, to add an element or elements to the end of a
>> possibly non-existent list, you say:
>>
>> push @list, $elem;
>>
>> To pull one element off the end:
>>
>> pop @list;
>>
>> To pull one off the front:
>>
>> shift @list;
>>
>> To push one onto the front:
>>
>> unshift @list, $elem;
>>
>> With such a collection we could rid ourselves of all those silly
>> statements like:
>>
>> if n_elements(list) eq 0 then list=[elem] else list=[list, elem]
>
> Ahem:
>
> pro push,list,elem
> if n_elements(list) eq 0 then list=[elem] else list=[list, elem]
> end

I had one just like this in my collection, but I just didn't feel right
spawning a function call and path search just to add an element to a
list. A built-in method would be much preferrable.

JD
[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
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL virtual reality (was 3D Object IDL )
Next Topic: problem getting values from cw_bgroup normal base

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

Current Time: Wed Oct 08 16:49:19 PDT 2025

Total time taken to generate the page: 0.00457 seconds