There is no portable way of doing that. The only way to do that would be using a macro with an &env argument and inspecting it to know what symbols are in scope. However, "environments" differ from implementation to implementation. Of course, you can try to do that using tools provided by your particular implementation