# Clear the workspace of all objects whose names don't start with a
# full stop, and remove objects attached immediately after the global 
clear <-
function () 
{
    env <- as.environment(1)
    to.go <- ls(env, all.names = FALSE)
    continue <- TRUE
    while (continue) {
        nxt <- search()[[2]]
        if (substr(nxt, 1, 8) != "package:") 
            detach()
        else continue <- FALSE
    }
    remove(list = to.go, envir = env)
}

