How to kill all but a function?



On 8/16/10, Stefano Ferri <ferriste at gmail.com> wrote:

> 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.

Won't kill(allbut(f, x)) have the effect you want?

I don't know what you're trying to accomplish,
but on the face of it, kill(all) in any form seems kind of
heavy-handed ... Maybe it is truly necessary, I don't know.

best

Robert Dodier