New eval_in_env() function

Not complete but it covers some cases and I've included tests.