message: refactor(renderer): inline tree traversal for evaluation
diff: import {AST, traverse} from '.';
  export default function(ast, globals?) {
  - return environment({}, globals || {}, evaluate(ast));
  + return runtime({}, globals || {}, evaluate(ast));
  }
  function evaluate(ast: AST): (environment: Environment) => any {
  - return ({resolve}) =>
  - traverse(ast, (type, value) => {
  - switch (type) {
  + return ({resolve, withinSameScope}) => {
  + switch (ast[0]) {
  case 'identifier':
  - return resolve(value);
  + return resolve(ast[1]);
  case 'literal':
  - return value;
  + return ast[1];
  case 'list':
  - const [first, ...rest] = value;
  + const [first, ...rest] = ast[1].map(node => withinSameScope(evaluate(node)));
  if (typeof first === 'function') return first.call(undefined, ...rest);
  return [first, ...rest];
  }
  - });
  + };
  }
  interface Scope {
  @@ -26,14 +25,10 @@ interface Scope {
  interface Environment {
  resolve(identifier: string): any;
  - withinNewScope<T>(program: (environment: Environment) => T): T;
  + withinSameScope<T>(program: (environment: Environment) => T): T;
  }
  -function environment<T>(
  - keywords: Scope,
  - globals: Scope,
  - program: (environment: Environment) => T,
  -): T {
  +function runtime<T>(keywords: Scope, globals: Scope, program: (environment: Environment) => T): T {
  function resolve(env: Array<Scope>, identifier: string): any {
  const result = env.find(scope => identifier in scope)?.[identifier];
  if (result === undefined) throw `AST contains an unknown identifier: ${identifier}`;
  @@ -41,10 +36,11 @@ function environment<T>(
  }
  function withinEnvironment<T>(env: Array<Scope>, program: (environment: Environment) => T): T {
  - return program({
  + const environment: Environment = {
  resolve: identifier => resolve(env, identifier),
  - withinNewScope: program => withinEnvironment([{}, ...env], program),
  - });
  + withinSameScope: program => program(environment),
  + };
  + return program(environment);
  }
  return withinEnvironment([globals], program);
  