How to kill the content of a list instead of the list itself?
Subject: How to kill the content of a list instead of the list itself?
From: Stefano Ferri
Date: Wed, 29 Dec 2010 15:20:26 +0100
> I think you have to take into account, that the symbols evaluate to
> their numerical value.
>
Thank you, maybe I've made a bit of confusion about this point... But there
is still an issue: if a, b and c are contained in an unnamed list [a, b, c]
they can be killed by apply(kill,'[a,b,c]), and this is clear. The problem
comes when the list [a,b,c] is assigned to a variable:
mylist : [a,b,c]
The only solution I've found is this: mylist must either be defined before
assigning a value to a, b and c, or defined as
mylist : '[a, b, c]
then apply(kill, mylist) works fine.
But I have the problem that mylist may already exist and contain every type
of argument, with assigned values or not, and I have to kill its arguments,
without killing and possibly without empty the list itself...
For example, if mylist : [a, b, c]
'mylist;
[a,b,c]
mylist;
[1,2,3]
a;
1
b;
2
c;
3
I should be able to kill a,b,c but without touching the list. After all I
should get:
some command to kill....
'mylist;
[a,b,c]
mylist;
[a,b,c]
a;
a
b;
b
c;
c
I hope that the problem is clear now... Thanks for patience :-)
Stefano