eval function

dynamic eval(
  1. Environment env,
  2. dynamic expr
)

The evaluation function.

Implementation

dynamic eval(Environment env, dynamic expr) {
  env.checkInterrupt();
  if (expr is Cons) {
    final Function function = eval(env, expr.head);
    return function(env, expr.tail);
  } else if (expr is Name) {
    return env[expr];
  } else {
    return expr;
  }
}