I believe that when you assign a list to variable X, that X is a reference
(or pointer) to the original list.  (Unlike other situations like a number
or a string where a copy of the value is stored in X.)  When you change
something via the reference, the original is changed as well.  Lingo
probably does this because lists can potentially be big and you may
inadvertantly take up alot of memory by making lots of copies of it.  To get
what you want done, make X be a copy of the list by using "duplicate."


----- Original Message -----
From: "Changhsu P. Liu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 20, 2002 7:24 PM
Subject: <lingo-l> a simple list question!


> I'd like to delete some items during a calculation on a list. But, I want
> it intact after all the calculation.
> So, I thought I save it to a temporary list and put it back when done.
>
> tempList = initialList
> ...
> all the deleteAt on initialList
> ...
> initialList = tempList -- to get it back so I thought
>
> But, to my surprise when I delete items from initialList, tempList get the
> items deleted too. I can put the initial list content to a field and
> extract them later after calculation. Is there a better way to deal with
this?
>
> Thanks for the help,
>
>
> Changhsu Liu
>
> [To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is
for learning and helping with programming Lingo.  Thanks!]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to