I have a function that, at the beginning, must do a kill(all) (except
for its argument), and then execute some code.
f(x) := block([], kill(allbut(x)), some commands... )$
This function can be exexuted only once, because after execution it is killed.
Obviously, I don't want f(x) to be killed. So, because remfunction has
not a feature like remfunction(allbut(f(x)), I was thinking to such a
thing:
f(x) := block([], kill(allbut(x,delete(f(x),functions)), some commands... )$
But, even though f(x) is listed in the function list, delete seems to
have no effect. It is quite surprising to me, even more looking at the
following example commands:
(%i44) functions;
(%o44) [f(x)]
(%i45) member(f(x),functions);
(%o45) false
(%i46) functions[1];
(%o46) f(x)
(%i47) member(functions[1],functions);
(%o47) true
(%i48) delete(functions[1],functions);
(%o48) []
Why f(x) is not recognized as a member of the functions list? Why is
it recognized only if called as functions[1]?
I am really confused...
Thak you for any explanation.
Stefano